core/blockchain: remove useless locking of txLookup

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2025-12-18 09:03:02 +01:00
parent 69341bc95a
commit 90344dc27b
No known key found for this signature in database
GPG key ID: 0FE274EE8C95166E

View file

@ -329,12 +329,9 @@ func (bc *BlockChain) GetAncestor(hash common.Hash, number, ancestor uint64, max
// access altogether.
func (bc *BlockChain) HasCanonicalTransaction(hash common.Hash, cacheOnly bool) bool {
// Check in memory cache first
bc.txLookupLock.RLock()
if _, exist := bc.txLookupCache.Get(hash); exist {
bc.txLookupLock.RUnlock()
return true
}
bc.txLookupLock.RUnlock()
// Fallback to database lookup, without reading the transaction itself
if !cacheOnly && rawdb.HasCanonicalTransaction(bc.db, hash) {