Browse Source

Merge #7874: Improve AlreadyHave

c6cb6f7 Avoid unnecessary database access for unknown transactions (Alex Morcos)
0.13
Wladimir J. van der Laan 9 years ago
parent
commit
e6a4d48a9b
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 4
      src/main.cpp

4
src/main.cpp

@ -4344,10 +4344,12 @@ bool static AlreadyHave(const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
recentRejects->reset(); recentRejects->reset();
} }
// Use pcoinsTip->HaveCoinsInCache as a quick approximation to exclude
// requesting or processing some txs which have already been included in a block
return recentRejects->contains(inv.hash) || return recentRejects->contains(inv.hash) ||
mempool.exists(inv.hash) || mempool.exists(inv.hash) ||
mapOrphanTransactions.count(inv.hash) || mapOrphanTransactions.count(inv.hash) ||
pcoinsTip->HaveCoins(inv.hash); pcoinsTip->HaveCoinsInCache(inv.hash);
} }
case MSG_BLOCK: case MSG_BLOCK:
return mapBlockIndex.count(inv.hash); return mapBlockIndex.count(inv.hash);

Loading…
Cancel
Save