cmd/geth: use PruneTransactionIndex

This commit is contained in:
Felix Lange 2025-03-18 16:57:12 +01:00
parent 2e470f1865
commit 403e64ce75

View file

@ -647,8 +647,6 @@ func pruneHistory(ctx *cli.Context) error {
return fmt.Errorf("merge block hash mismatch: got %s, want %s", hash.Hex(), mergeBlockHash) return fmt.Errorf("merge block hash mismatch: got %s, want %s", hash.Hex(), mergeBlockHash)
} }
txlookupTail := rawdb.ReadTxIndexTail(chaindb)
log.Info("Starting chain pruning", log.Info("Starting chain pruning",
"currentHeight", currentHeader.Number, "currentHeight", currentHeader.Number,
"mergeBlock", mergeBlock, "mergeBlock", mergeBlock,
@ -656,11 +654,7 @@ func pruneHistory(ctx *cli.Context) error {
start := time.Now() start := time.Now()
// First prune the transaction lookup index as rawdb.PruneTransactionIndex(chaindb, mergeBlock)
// it requires the block bodies.
if txlookupTail != nil && *txlookupTail < mergeBlock {
rawdb.UnindexTransactions(chaindb, *txlookupTail, mergeBlock, nil, false)
}
// TODO(s1na): what if there is a crash between the two prune operations? // TODO(s1na): what if there is a crash between the two prune operations?