mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-19 22:40:31 +00:00
core: fix txLookupLock mutex leak on error returns in reorg() (#34039)
This commit is contained in:
parent
ab357151da
commit
b6115e9a30
1 changed files with 1 additions and 3 deletions
|
|
@ -2628,6 +2628,7 @@ func (bc *BlockChain) reorg(oldHead *types.Header, newHead *types.Header) error
|
||||||
// as the txlookups should be changed atomically, and all subsequent
|
// as the txlookups should be changed atomically, and all subsequent
|
||||||
// reads should be blocked until the mutation is complete.
|
// reads should be blocked until the mutation is complete.
|
||||||
bc.txLookupLock.Lock()
|
bc.txLookupLock.Lock()
|
||||||
|
defer bc.txLookupLock.Unlock()
|
||||||
|
|
||||||
// Reorg can be executed, start reducing the chain's old blocks and appending
|
// Reorg can be executed, start reducing the chain's old blocks and appending
|
||||||
// the new blocks
|
// the new blocks
|
||||||
|
|
@ -2730,9 +2731,6 @@ func (bc *BlockChain) reorg(oldHead *types.Header, newHead *types.Header) error
|
||||||
// Reset the tx lookup cache to clear stale txlookup cache.
|
// Reset the tx lookup cache to clear stale txlookup cache.
|
||||||
bc.txLookupCache.Purge()
|
bc.txLookupCache.Purge()
|
||||||
|
|
||||||
// Release the tx-lookup lock after mutation.
|
|
||||||
bc.txLookupLock.Unlock()
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue