Skip to content

Commit e26777b

Browse files
committed
fix txLookupLock mutex leak on error returns in reorg
1 parent 068a35c commit e26777b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

core/blockchain.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,6 +2204,7 @@ func (bc *BlockChain) reorg(oldBlock, newBlock *types.Header) error {
22042204
// as the txlookups should be changed atomically, and all subsequent
22052205
// reads should be blocked until the mutation is complete.
22062206
bc.txLookupLock.Lock()
2207+
defer bc.txLookupLock.Unlock()
22072208

22082209
var (
22092210
deletedTxs []common.Hash
@@ -2314,9 +2315,6 @@ func (bc *BlockChain) reorg(oldBlock, newBlock *types.Header) error {
23142315
// Reset the tx lookup cache to clear stale txlookup cache.
23152316
bc.txLookupCache.Purge()
23162317

2317-
// Release the tx-lookup lock after mutation.
2318-
bc.txLookupLock.Unlock()
2319-
23202318
return nil
23212319
}
23222320

0 commit comments

Comments
 (0)