Skip to content

Commit

Permalink
add baseBlock comment, fix referencing befor StateAt
Browse files Browse the repository at this point in the history
  • Loading branch information
magicxyyz committed Dec 11, 2023
1 parent 0227c54 commit 8d5951a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion eth/state_accessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import (
// - reexec: The maximum number of blocks to reprocess trying to obtain the desired state
// - base: If the caller is tracing multiple blocks, the caller can provide the parent
// state continuously from the callsite.
// - baseBlock: Arbitrum specific: caller can provide the block from which reprocessing should start. Previous argument (base) is assumed to be the state at the block. If base is not provided, baseBlock is ignored.
// - readOnly: If true, then the live 'blockchain' state database is used. No mutation should
// be made from caller, e.g. perform Commit or other 'save-to-disk' changes.
// Otherwise, the trash generated by caller may be persisted permanently.
Expand All @@ -68,7 +69,7 @@ func (eth *Ethereum) StateAtBlock(ctx context.Context, block *types.Block, reexe
// function to deref it.

// Try referencing the root, if it isn't in dirties cache then Reference will have no effect
statedb.Database().TrieDB().Reference(block.Root(), common.Hash{})
eth.blockchain.StateCache().TrieDB().Reference(block.Root(), common.Hash{})
if statedb, err = eth.blockchain.StateAt(block.Root()); err == nil {
return statedb, func() {
statedb.Database().TrieDB().Dereference(block.Root())
Expand Down

0 comments on commit 8d5951a

Please sign in to comment.