core/rawdb: restore TD freezer table for backward compatibility

This commit is contained in:
Gary Rong 2024-11-22 20:43:03 +08:00
parent 3b27580cc7
commit f2320d832c
2 changed files with 16 additions and 4 deletions

View file

@ -726,6 +726,14 @@ func writeAncientBlock(op ethdb.AncientWriteOp, block *types.Block, header *type
if err := op.Append(ChainFreezerReceiptTable, num, receipts); err != nil {
return fmt.Errorf("can't append block %d receipts: %v", num, 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, num, big.NewInt(0)); err != nil {
return fmt.Errorf("can't append block %d total difficulty: %v", num, err)
}
return nil
}

View file

@ -35,6 +35,9 @@ const (
// ChainFreezerReceiptTable indicates the name of the freezer receipts table.
ChainFreezerReceiptTable = "receipts"
// ChainFreezerDifficultyTable indicates the name of the freezer total difficulty table.
ChainFreezerDifficultyTable = "diffs"
)
// chainFreezerNoSnappy configures whether compression is disabled for the ancient-tables.
@ -44,6 +47,7 @@ var chainFreezerNoSnappy = map[string]bool{
ChainFreezerHashTable: true,
ChainFreezerBodiesTable: false,
ChainFreezerReceiptTable: false,
ChainFreezerDifficultyTable: true,
}
const (