@@ -48,13 +48,16 @@ func (e *executionResults) Equal(f *executionResults) bool {
4848}
4949
5050// MarkExecuted marks the block as having being executed at the specified
51- // time(s) and with the specified results. This function MUST NOT be called more
52- // than once. The wall-clock [time.Time] is for metrics only .
51+ // time(s) and with the specified results. It also sets the chain's head block
52+ // to b .
5353//
5454// MarkExecuted guarantees that state is persisted to the database before
5555// in-memory indicators of execution are updated. [Block.Executed] returning
5656// true is therefore indicative of a successful database write by MarkExecuted.
57- func (b * Block ) MarkExecuted (db ethdb.Database , isLastSyncBlock bool , byGas * gastime.Time , byWall time.Time , receipts types.Receipts , stateRootPost common.Hash ) error {
57+ //
58+ // This function MUST NOT be called more than once. The wall-clock [time.Time]
59+ // is for metrics only.
60+ func (b * Block ) MarkExecuted (db ethdb.Database , byGas * gastime.Time , byWall time.Time , receipts types.Receipts , stateRootPost common.Hash ) error {
5861 var used gas.Gas
5962 for _ , r := range receipts {
6063 used += gas .Gas (r .GasUsed )
@@ -70,14 +73,8 @@ func (b *Block) MarkExecuted(db ethdb.Database, isLastSyncBlock bool, byGas *gas
7073 }
7174
7275 batch := db .NewBatch ()
73- if ! isLastSyncBlock {
74- // Although the last synchronous block is required to be the head block
75- // at the time of upgrade, not setting the head here allows this method
76- // to be called idempotently for that block. This is useful when
77- // converting it to an SAE block.
78- rawdb .WriteHeadBlockHash (batch , b .Hash ())
79- rawdb .WriteHeadHeaderHash (batch , b .Hash ())
80- }
76+ rawdb .WriteHeadBlockHash (batch , b .Hash ())
77+ rawdb .WriteHeadHeaderHash (batch , b .Hash ())
8178 rawdb .WriteReceipts (batch , b .Hash (), b .NumberU64 (), receipts )
8279 if err := b .writePostExecutionState (batch , e ); err != nil {
8380 return err
0 commit comments