From 6ff924abf5c1a07a90f04c547cf7986bbe1264ca Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Mon, 27 Nov 2023 13:12:26 +0100 Subject: [PATCH] eth/catalyst: add comments --- eth/catalyst/simulated_beacon.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eth/catalyst/simulated_beacon.go b/eth/catalyst/simulated_beacon.go index e1ac4727d3..2f5d685a3b 100644 --- a/eth/catalyst/simulated_beacon.go +++ b/eth/catalyst/simulated_beacon.go @@ -274,6 +274,7 @@ func (c *SimulatedBeacon) setCurrentState(headHash, finalizedHash common.Hash) { } } +// Commit seals a block on demand. func (c *SimulatedBeacon) Commit() common.Hash { withdrawals := c.withdrawals.gatherPending(10) if err := c.sealBlock(withdrawals, uint64(time.Now().Unix())); err != nil { @@ -282,7 +283,7 @@ func (c *SimulatedBeacon) Commit() common.Hash { return c.eth.BlockChain().CurrentBlock().Hash() } -// Rollback un-sends previously added transactions +// Rollback un-sends previously added transactions. func (c *SimulatedBeacon) Rollback() { // Flush all transactions from the transaction pools c.eth.TxPool().SetGasTip(big.NewInt(-1)) @@ -291,6 +292,7 @@ func (c *SimulatedBeacon) Rollback() { c.eth.TxPool().SetGasTip(big.NewInt(params.GWei)) } +// Fork sets the head to the provided hash. func (c *SimulatedBeacon) Fork(ctx context.Context, parentHash common.Hash) error { if len(c.eth.TxPool().Pending(false)) != 0 { return errors.New("pending block dirty") @@ -302,6 +304,7 @@ func (c *SimulatedBeacon) Fork(ctx context.Context, parentHash common.Hash) erro return c.eth.BlockChain().SetHead(parent.NumberU64()) } +// AdjustTime creates a new block with an adjusted timestamp. func (c *SimulatedBeacon) AdjustTime(adjustment time.Duration) error { if len(c.eth.TxPool().Pending(false)) != 0 { return errors.New("could not adjust time on non-empty block")