Skip to content

Commit

Permalink
fix: fix incorrect comment
Browse files Browse the repository at this point in the history
  • Loading branch information
VM committed Mar 27, 2024
1 parent e3a02fb commit 576f337
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ func (bc *BlockChain) tryRewindBadBlocks() {
}
}

// rewindPathHead implements the logic of rewindHead in the context of hash scheme.
// rewindHashHead implements the logic of rewindHead in the context of hash scheme.
func (bc *BlockChain) rewindHashHead(head *types.Header, root common.Hash) (*types.Header, uint64) {
var (
limit uint64 // The oldest block that will be searched for this rewinding
Expand Down
1 change: 1 addition & 0 deletions triedb/pathdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ func (db *Database) Commit(root common.Hash, report bool) error {
if err := db.modifyAllowed(); err != nil {
return err
}

return db.tree.cap(root, 0)
}

Expand Down
3 changes: 2 additions & 1 deletion triedb/pathdb/disklayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ func (dl *diskLayer) commit(bottom *diffLayer, force bool) (*diskLayer, error) {
// truncation) surpasses the persisted state ID, we take the necessary action
// of forcibly committing the cached dirty nodes to ensure that the persisted
// state ID remains higher.
if !force && rawdb.ReadPersistentStateID(dl.db.diskdb) < oldest {
stateID := rawdb.ReadPersistentStateID(dl.db.diskdb)
if !force && stateID < oldest {
force = true
}
if err := ndl.buffer.flush(ndl.db.diskdb, ndl.cleans, ndl.id, force); err != nil {
Expand Down

0 comments on commit 576f337

Please sign in to comment.