From 28839dac18b851e303647585fe8dd1d74df1ade3 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 9 Mar 2023 13:34:47 +0100 Subject: [PATCH] core: add Timestamp method in BlockGen Since forks are now scheduled by block time, it can be necessary to check the timestamp of a block while generating transactions. --- core/chain_makers.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/chain_makers.go b/core/chain_makers.go index 052d6efae2f7..61d0098af3f6 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -156,6 +156,11 @@ func (b *BlockGen) Number() *big.Int { return new(big.Int).Set(b.header.Number) } +// Timestamp returns the timestamp of the block being generated. +func (b *BlockGen) Timestamp() uint64 { + return b.header.Time +} + // BaseFee returns the EIP-1559 base fee of the block being generated. func (b *BlockGen) BaseFee() *big.Int { return new(big.Int).Set(b.header.BaseFee)