aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-10-09 14:57:56 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-10-09 14:58:01 +0200
commitb4dc33e9fbbc3f4f38f480e42af37be6823f4675 (patch)
tree8c519e212cf7ce5142eb5c45eee33e1742923ffb
parentb4ad73f706196272589451ce3d223f3df029eea1 (diff)
parent36f14bf2e770220a3878da45722352553eb665cc (diff)
Merge pull request #6785
36f14bf In (strCommand == "tx"), return if AlreadyHave() (Tom Harding)
-rw-r--r--src/main.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp
index cb41afc96b..1b4630787d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -4369,6 +4369,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
mapAlreadyAskedFor.erase(inv);
+ // Check for recently rejected (and do other quick existence checks)
+ if (AlreadyHave(inv))
+ return true;
+
if (AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs))
{
mempool.check(pcoinsTip);
@@ -4444,13 +4448,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
if (nEvicted > 0)
LogPrint("mempool", "mapOrphan overflow, removed %u tx\n", nEvicted);
} else {
- // AcceptToMemoryPool() returned false, possibly because the tx is
- // already in the mempool; if the tx isn't in the mempool that
- // means it was rejected and we shouldn't ask for it again.
- if (!mempool.exists(tx.GetHash())) {
- assert(recentRejects);
- recentRejects->insert(tx.GetHash());
- }
+ assert(recentRejects);
+ recentRejects->insert(tx.GetHash());
+
if (pfrom->fWhitelisted) {
// Always relay transactions received from whitelisted peers, even
// if they were rejected from the mempool, allowing the node to