mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core: reset txlookup cache if reorg happens
This commit is contained in:
parent
7b97c59f2f
commit
064315d6b3
1 changed files with 3 additions and 4 deletions
|
|
@ -2209,10 +2209,9 @@ func (bc *BlockChain) reorg(oldHead *types.Header, newHead *types.Block) error {
|
||||||
for _, tx := range diffs {
|
for _, tx := range diffs {
|
||||||
rawdb.DeleteTxLookupEntry(indexesBatch, tx)
|
rawdb.DeleteTxLookupEntry(indexesBatch, tx)
|
||||||
}
|
}
|
||||||
// Reset the tx lookup cache in case some indexes are removed.
|
// Reset the tx lookup cache in case to clear stale txlookups.
|
||||||
if len(diffs) > 0 {
|
|
||||||
bc.txLookupCache.Purge()
|
bc.txLookupCache.Purge()
|
||||||
}
|
|
||||||
// Delete all hash markers that are not part of the new canonical chain.
|
// Delete all hash markers that are not part of the new canonical chain.
|
||||||
// Because the reorg function does not handle new chain head, all hash
|
// Because the reorg function does not handle new chain head, all hash
|
||||||
// markers greater than or equal to new chain head should be deleted.
|
// markers greater than or equal to new chain head should be deleted.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue