Skip to content

writeAncientBlockPoW

Source (upstream pre-purge) Current
File core/rawdb/accessors_chain.go accessors_chain_pow.go
Symbol writeAncientBlock writeAncientBlockPoW
Ref 39638c81c~1 etc/v1.17.3-full-node

Renamed with PoW suffix. The td *big.Int param and ChainFreezerDifficultyTable write were already present in the pre-purge original — upstream removed them post-merge, we retain them. Only visible diff: receipts type changed from []*types.ReceiptForStorage to rlp.RawValue.

3-way merge — purge → getc ← upstream

pre-purgecommonfork-only
func writeAncientBlockPoW(op ethdb.AncientWriteOp, block *types.Block, header *types.Header, receipts rlp.RawValue, td *big.Int) error {
num := block.NumberU64()
if err := op.AppendRaw(ChainFreezerHashTable, num, block.Hash().Bytes()); err != nil {
return fmt.Errorf("can't add block %d hash: %v", num, err)
}
if err := op.Append(ChainFreezerHeaderTable, num, header); err != nil {
return fmt.Errorf("can't append block header %d: %v", num, err)
}
if err := op.Append(ChainFreezerBodiesTable, num, block.Body()); err != nil {
return fmt.Errorf("can't append block body %d: %v", num, err)
}
if err := op.Append(ChainFreezerReceiptTable, num, receipts); err != nil {
return fmt.Errorf("can't append block %d receipts: %v", num, err)
}
if err := op.Append(ChainFreezerDifficultyTable, num, td); err != nil {
return fmt.Errorf("can't append block %d total difficulty: %v", num, err)
}
return nil
}
core-geth validation — +1 -1 | | | |---|---| | File | [`accessors_chain.go`](https://github.com/etclabscore/core-geth/blob/v1.12.20/core/rawdb/accessors_chain.go) | | Symbol | `writeAncientBlock` | | Ref | `v1.12.20` |
--- a/core-geth/core/rawdb/accessors_chain.go
+++ b/etc/core/rawdb/accessors_chain_pow.go
@@ -1,4 +1,4 @@
-func writeAncientBlock(op ethdb.AncientWriteOp, block *types.Block, header *types.Header, receipts []*types.ReceiptForStorage, td *big.Int) error {
+func writeAncientBlockPoW(op ethdb.AncientWriteOp, block *types.Block, header *types.Header, receipts rlp.RawValue, td *big.Int) error {
    num := block.NumberU64()
    if err := op.AppendRaw(ChainFreezerHashTable, num, block.Hash().Bytes()); err != nil {
        return fmt.Errorf("can't add block %d hash: %v", num, err)

← Total Difficulty (TD)