Skip to content

Commit

Permalink
fix: delete version check whrn rewind
Browse files Browse the repository at this point in the history
  • Loading branch information
joeylichang committed Sep 4, 2024
1 parent de4be08 commit 6135d38
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -785,15 +785,13 @@ func (bc *BlockChain) loadLastState() error {
log.Info("begin rewind versa db head", "target_number", archiveVersion, "target_root", archiveRoot.String())
for {
log.Info("rewinding block", "number", headBlock.NumberU64(), "hash", headBlock.Hash(), "root", headBlock.Root().String(), "target_number", archiveVersion, "target_root", archiveRoot.String())
if archiveRoot.Cmp(headBlock.Root()) == 0 && archiveVersion == headBlock.Number().Int64() {
if archiveRoot.Cmp(headBlock.Root()) == 0 {
rawdb.WriteCanonicalHash(bc.db, headBlock.Hash(), headBlock.NumberU64())
rawdb.WriteHeadHeaderHash(bc.db, headBlock.Hash())
rawdb.WriteHeadBlockHash(bc.db, headBlock.Hash())
rawdb.WriteHeadFastBlockHash(bc.db, headBlock.Hash())
log.Info("success to reset versa db head block", "number", headBlock.NumberU64(), "hash", headBlock.Hash(), "root", headBlock.Root().String())
break
} else if archiveRoot.Cmp(headBlock.Root()) == 0 {
log.Info("reset versa db meet same root", "number", headBlock.NumberU64(), "target_number", archiveVersion, "target_root", archiveRoot.String())
} else if archiveVersion == headBlock.Number().Int64() {
log.Crit("failed to reset versa db meet same version", "number", headBlock.NumberU64(), "target_number", archiveVersion, "target_root", archiveRoot.String())
}
Expand Down

0 comments on commit 6135d38

Please sign in to comment.