Skip to content

core/rawdb/accessors_chain_pow.go — Version Comparison

v1.17.3 v1.17.4
Branch etc/v1.17.3-full-node etc/v1.17.4-full-node
Delta +92 -0 +106 -0

Diff between branches

diff --git a/core/rawdb/accessors_chain_pow.go b/core/rawdb/accessors_chain_pow.go
index f256f38cc..b2791a1a0 100644
--- a/core/rawdb/accessors_chain_pow.go
+++ b/core/rawdb/accessors_chain_pow.go
@@ -57,6 +57,13 @@ func writeAncientBlockPoW(op ethdb.AncientWriteOp, block *types.Block, header *t
    if err := op.Append(ChainFreezerReceiptTable, num, receipts); err != nil {
        return fmt.Errorf("can't append block %d receipts: %v", num, err)
    }
+   // The assumption is held that BAL of ancient block is no longer available
+   // (it may still reachable, but it's not worthwhile to even retrieve it
+   // from the network). A nil entry is stored in the BAL table as the absence
+   // placeholder.
+   if err := op.AppendRaw(ChainFreezerBALTable, num, nil); err != nil {
+       return fmt.Errorf("can't append block %d bals: %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)
    }
@@ -83,6 +90,13 @@ func WriteAncientHeaderChainPoW(db ethdb.AncientWriter, headers []*types.Header,
            if err := op.AppendRaw(ChainFreezerReceiptTable, num, nil); err != nil {
                return fmt.Errorf("can't append block %d receipts: %v", num, err)
            }
+           // The assumption is held that BAL of ancient block is no longer available
+           // (it may still reachable, but it's not worthwhile to even retrieve it
+           // from the network). A nil entry is stored in the BAL table as the absence
+           // placeholder.
+           if err := op.AppendRaw(ChainFreezerBALTable, num, nil); err != nil {
+               return fmt.Errorf("can't append block %d bals: %v", num, err)
+           }
            if err := op.Append(ChainFreezerDifficultyTable, num, new(big.Int).Set(tdSum)); err != nil {
                return fmt.Errorf("can't append block %d total difficulty: %v", num, err)
            }
← Back to Version Comparison