Skip to content

Commit

Permalink
Merge #7874: Improve AlreadyHave
Browse files Browse the repository at this point in the history
c6cb6f7 Avoid unnecessary database access for unknown transactions (Alex Morcos)
  • Loading branch information
laanwj committed Apr 14, 2016
2 parents 6ef5e00 + c6cb6f7 commit e6a4d48
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit e6a4d48

Please sign in to comment.