From e26777b2450b08c0c133c78f4dc85ef6993b17fc Mon Sep 17 00:00:00 2001 From: ucwong Date: Wed, 18 Mar 2026 16:42:12 +0000 Subject: [PATCH] fix txLookupLock mutex leak on error returns in reorg --- core/blockchain.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index 042226fe52..9c84eed077 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -2204,6 +2204,7 @@ func (bc *BlockChain) reorg(oldBlock, newBlock *types.Header) error { // as the txlookups should be changed atomically, and all subsequent // reads should be blocked until the mutation is complete. bc.txLookupLock.Lock() + defer bc.txLookupLock.Unlock() var ( deletedTxs []common.Hash @@ -2314,9 +2315,6 @@ func (bc *BlockChain) reorg(oldBlock, newBlock *types.Header) error { // Reset the tx lookup cache to clear stale txlookup cache. bc.txLookupCache.Purge() - // Release the tx-lookup lock after mutation. - bc.txLookupLock.Unlock() - return nil }