@@ -217,7 +217,13 @@ func (eth *Ethereum) stateAtBlock(ctx context.Context, block *types.Block, reexe
217217 return eth .pathState (block )
218218}
219219
220- // stateAtTransaction returns the execution environment of a certain transaction.
220+ // stateAtTransaction returns the execution environment of a certain
221+ // transaction.
222+ //
223+ // Note: when a block is empty and the state for tx index 0 is requested, this
224+ // function will return the state of block after the pre-block operations have
225+ // been completed (e.g. updating system contracts), but before post-block
226+ // operations are completed (e.g. processing withdrawals).
221227func (eth * Ethereum ) stateAtTransaction (ctx context.Context , block * types.Block , txIndex int , reexec uint64 ) (* types.Transaction , vm.BlockContext , * state.StateDB , tracers.StateReleaseFunc , error ) {
222228 // Short circuit if it's genesis block.
223229 if block .NumberU64 () == 0 {
@@ -245,7 +251,7 @@ func (eth *Ethereum) stateAtTransaction(ctx context.Context, block *types.Block,
245251 core .ProcessParentBlockHash (block .ParentHash (), evm )
246252 }
247253 if txIndex == 0 && len (block .Transactions ()) == 0 {
248- return nil , vm. BlockContext {} , statedb , release , nil
254+ return nil , context , statedb , release , nil
249255 }
250256 // Recompute transactions up to the target index.
251257 signer := types .MakeSigner (eth .blockchain .Config (), block .Number (), block .Time ())
0 commit comments