Skip to content

Commit cb21177

Browse files
authored
core: fix history pruning initialization for empty DB (#31656)
This fixes an issue where running geth with `--history.chain postmerge` would not work on an empty database. ``` ERROR[04-16|23:11:12.913] Chain history database is pruned to unknown block tail=0 Fatal: Failed to register the Ethereum service: unexpected database tail ```
1 parent 8797497 commit cb21177

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/blockchain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ func (bc *BlockChain) initializeHistoryPruning(latest uint64) error {
620620
if predefinedPoint == nil {
621621
log.Error("Chain history pruning is not supported for this network", "genesis", bc.genesisBlock.Hash())
622622
return fmt.Errorf("history pruning requested for unknown network")
623-
} else if freezerTail != predefinedPoint.BlockNumber {
623+
} else if freezerTail > 0 && freezerTail != predefinedPoint.BlockNumber {
624624
log.Error("Chain history database is pruned to unknown block", "tail", freezerTail)
625625
return fmt.Errorf("unexpected database tail")
626626
}

0 commit comments

Comments
 (0)