In core/blockchain.go, the reorg function acquires a write lock via bc.txLookupLock.Lock(). However, several early return paths (specifically when bc.GetBlock returns nil) fail to call bc.txLookupLock.Unlock().
Lines leading to leak:
[Line 2651]: return errInvalidOldChain
[Line 2670]: return errInvalidOldChain
[Line 2685]: return errInvalidNewChain
This will cause any subsequent transaction lookups or further reorgs to hang indefinitely.
Proposed Fix:
Use defer bc.txLookupLock.Unlock() right after bc.txLookupLock.Lock() and remove the manual Unlock() at the end of the function to ensure the lock is always released.