From 314e18193eeca3e47b627408da47e33132d72aa8 Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Mon, 25 Nov 2024 10:32:27 +0800 Subject: [PATCH] core: fix test and revert db version bumping --- core/blockchain.go | 5 +---- core/rawdb/chain_freezer.go | 8 ++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index 66dcad0dfd..2273c4aa96 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -127,10 +127,7 @@ const ( // - Version 8 // The following incompatible database changes were added: // * New scheme for contract code in order to separate the codes and trie nodes - // - Version 9 - // Total difficulty has been removed from both the key-value store and the - // ancient store, the td freezer table has been deprecated since that. - BlockChainVersion uint64 = 9 + BlockChainVersion uint64 = 8 ) // CacheConfig contains the configuration values for the trie database diff --git a/core/rawdb/chain_freezer.go b/core/rawdb/chain_freezer.go index 0627aca34c..7b5df7eb86 100644 --- a/core/rawdb/chain_freezer.go +++ b/core/rawdb/chain_freezer.go @@ -328,6 +328,14 @@ func (f *chainFreezer) freezeRange(nfdb *nofreezedb, number, limit uint64) (hash if err := op.AppendRaw(ChainFreezerReceiptTable, number, receipts); err != nil { return fmt.Errorf("can't write receipts to Freezer: %v", err) } + // TODO (rjl493456442) TD has been deprecated and write garbage data for + // backward compatibility. See https://github.com/ethereum/go-ethereum/pull/30744/. + // + // The TD freezer table is retained for backward compatibility within this + // major version (1.14.x) and will be discarded in the next major version. + if err := op.Append(ChainFreezerDifficultyTable, number, common.Big0); err != nil { + return fmt.Errorf("can't write td to Freezer: %v", err) + } hashes = append(hashes, hash) } return nil