fix: delete txlookup for txns in body on rewind

This commit is contained in:
jeevan-sid 2025-12-25 01:58:05 +05:30
parent 27b3a6087e
commit 4d6c3c2dcb

View file

@ -1075,10 +1075,16 @@ func (bc *BlockChain) setHeadBeyondRoot(head uint64, time uint64, root common.Ha
// Remove the associated body and receipts from the key-value store.
// The header, hash-to-number mapping, and canonical hash will be
// removed by the hc.SetHead function.
if body := rawdb.ReadBody(bc.db, hash, num); body != nil {
for _, tx := range body.Transactions {
rawdb.DeleteTxLookupEntry(db, tx.Hash())
}
}
rawdb.DeleteBody(db, hash, num)
rawdb.DeleteReceipts(db, hash, num)
}
// Todo(rjl493456442) txlookup, log index, etc
}
// If SetHead was only called as a chain reparation method, try to skip
// touching the header chain altogether, unless the freezer is broken