From 04045211772b7bc1fc9ee82aa4439aae32ba7696 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 16 Apr 2025 23:14:28 +0200 Subject: [PATCH] core: fix history pruning initialization for empty DB This fixes an issue where running geth with --history.chain postmerge would not work on an empty database. --- core/blockchain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/blockchain.go b/core/blockchain.go index 901a93315af3..203dcd269375 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -620,7 +620,7 @@ func (bc *BlockChain) initializeHistoryPruning(latest uint64) error { if predefinedPoint == nil { log.Error("Chain history pruning is not supported for this network", "genesis", bc.genesisBlock.Hash()) return fmt.Errorf("history pruning requested for unknown network") - } else if freezerTail != predefinedPoint.BlockNumber { + } else if freezerTail > 0 && freezerTail != predefinedPoint.BlockNumber { log.Error("Chain history database is pruned to unknown block", "tail", freezerTail) return fmt.Errorf("unexpected database tail") }