From 92c0695cf39df3e337a6dafac3323b0d064f979c Mon Sep 17 00:00:00 2001 From: Sina Mahmoodi Date: Mon, 14 Apr 2025 12:52:11 +0200 Subject: [PATCH] core: back-up to kvdb for a pruned block --- core/rawdb/accessors_chain.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go index 2f62d86e4b..9868c47e62 100644 --- a/core/rawdb/accessors_chain.go +++ b/core/rawdb/accessors_chain.go @@ -440,6 +440,12 @@ func ReadBodyRLP(db ethdb.Reader, hash common.Hash, number uint64) rlp.RawValue // Check if the data is in ancients if isCanon(reader, number, hash) { data, _ = reader.Ancient(ChainFreezerBodiesTable, number) + // The freezer might be pruned. In the particular case of genesis, the block + // will be still available in kvdb. The full genesis block is needed on startup + // sometimes for repair. + if data == nil { + data, _ = db.Get(blockBodyKey(number, hash)) + } return nil } // If not, try reading from leveldb