Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print state root every 100 blocks #240

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
// Finalize the block, applying any consensus engine specific extras (e.g. block rewards)
p.engine.Finalize(p.bc, header, statedb, block.Transactions(), block.Uncles())

if block.NumberU64()%100 == 0 {
stateRoot := statedb.GetTrie().Hash()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

statedb.GetTrie() will return the corresponding trie for the current height.
After the transition started, this will be a TransitionTrie which (*TransitionTrie).Hash() returns t.overlay.Hash().

log.Info("State root", "number", block.NumberU64(), "hash", stateRoot)
}

return receipts, allLogs, *usedGas, nil
}

Expand Down