Skip to content

Commit

Permalink
core: add Timestamp method in BlockGen (#26844)
Browse files Browse the repository at this point in the history
Since forks are now scheduled by block time, it can be necessary
to check the timestamp of a block while generating transactions.
  • Loading branch information
fjl authored Mar 10, 2023
1 parent 051493d commit 564db9a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/chain_makers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 564db9a

Please sign in to comment.