Skip to content

Commit c6cb6f7

Browse files
committed
Avoid unnecessary database access for unknown transactions
1 parent 5149935 commit c6cb6f7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4344,10 +4344,12 @@ bool static AlreadyHave(const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
43444344
recentRejects->reset();
43454345
}
43464346

4347+
// Use pcoinsTip->HaveCoinsInCache as a quick approximation to exclude
4348+
// requesting or processing some txs which have already been included in a block
43474349
return recentRejects->contains(inv.hash) ||
43484350
mempool.exists(inv.hash) ||
43494351
mapOrphanTransactions.count(inv.hash) ||
4350-
pcoinsTip->HaveCoins(inv.hash);
4352+
pcoinsTip->HaveCoinsInCache(inv.hash);
43514353
}
43524354
case MSG_BLOCK:
43534355
return mapBlockIndex.count(inv.hash);

0 commit comments

Comments
 (0)