diff --git a/core/blockchain.go b/core/blockchain.go index ab88f4b68e..b7738c6349 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