ethclient/simulated: added comments

This commit is contained in:
Marius van der Wijden 2024-01-08 15:05:48 +01:00
parent 12c05b9c02
commit a3276479b2
2 changed files with 5 additions and 5 deletions

View file

@ -144,9 +144,9 @@ func (c *SimulatedBeacon) Stop() error {
// sealBlock initiates payload building for a new block and creates a new block // sealBlock initiates payload building for a new block and creates a new block
// with the completed payload. // with the completed payload.
func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, tstamp uint64) error { func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp uint64) error {
if tstamp <= c.lastBlockTime { if timestamp <= c.lastBlockTime {
tstamp = c.lastBlockTime + 1 timestamp = c.lastBlockTime + 1
} }
c.feeRecipientLock.Lock() c.feeRecipientLock.Lock()
feeRecipient := c.feeRecipient feeRecipient := c.feeRecipient
@ -161,7 +161,7 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, tstamp uint
var random [32]byte var random [32]byte
rand.Read(random[:]) rand.Read(random[:])
fcResponse, err := c.engineAPI.ForkchoiceUpdatedV2(c.curForkchoiceState, &engine.PayloadAttributes{ fcResponse, err := c.engineAPI.ForkchoiceUpdatedV2(c.curForkchoiceState, &engine.PayloadAttributes{
Timestamp: tstamp, Timestamp: timestamp,
SuggestedFeeRecipient: feeRecipient, SuggestedFeeRecipient: feeRecipient,
Withdrawals: withdrawals, Withdrawals: withdrawals,
Random: random, Random: random,

View file

@ -178,7 +178,7 @@ func (n *Backend) Fork(parentHash common.Hash) error {
return n.beacon.Fork(parentHash) return n.beacon.Fork(parentHash)
} }
// AdjustTime changes the block timestamp. // AdjustTime changes the block timestamp and creates a new block.
// It can only be called on empty blocks. // It can only be called on empty blocks.
func (n *Backend) AdjustTime(adjustment time.Duration) error { func (n *Backend) AdjustTime(adjustment time.Duration) error {
return n.beacon.AdjustTime(adjustment) return n.beacon.AdjustTime(adjustment)