diff options
| author | Alex Morcos <[email protected]> | 2016-04-13 16:02:46 -0400 |
|---|---|---|
| committer | Alex Morcos <[email protected]> | 2016-04-13 16:02:46 -0400 |
| commit | c6cb6f7d4c4bbfe96256c66b3aef4e7e3ff6285f (patch) | |
| tree | 01ca2793917c3fe9caa450d78702b192da28679b /src/main.cpp | |
| parent | Merge #7828: Trivial: Globals: Explicitly pass const CChainParams& to Process... (diff) | |
| download | discoin-c6cb6f7d4c4bbfe96256c66b3aef4e7e3ff6285f.tar.xz discoin-c6cb6f7d4c4bbfe96256c66b3aef4e7e3ff6285f.zip | |
Avoid unnecessary database access for unknown transactions
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 9b164c799..f5baf3559 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4344,10 +4344,12 @@ bool static AlreadyHave(const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main) 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) || mempool.exists(inv.hash) || mapOrphanTransactions.count(inv.hash) || - pcoinsTip->HaveCoins(inv.hash); + pcoinsTip->HaveCoinsInCache(inv.hash); } case MSG_BLOCK: return mapBlockIndex.count(inv.hash); |