diff options
author | Amiti Uttarwar <amiti@uttarwar.org> | 2020-01-29 08:12:59 -0800 |
---|---|---|
committer | Amiti Uttarwar <amiti@uttarwar.org> | 2020-04-23 14:42:25 -0700 |
commit | 89eeb4a3335f8e871cc3f5286af4546dff66172a (patch) | |
tree | 6705d43114fbd4a7d308c10a9f3ef27c0556c81f /src/net_processing.cpp | |
parent | 23991ee53af21c2fdc28f6e8e002dc1455c71098 (diff) |
[mempool] Track "unbroadcast" transactions
- Mempool tracks locally submitted transactions (wallet or rpc)
- Transactions are removed from set when the node receives a GETDATA request
from a peer, or if the transaction is removed from the mempool.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r-- | src/net_processing.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index ab430cbe19..4756d35fe5 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1556,7 +1556,7 @@ void static ProcessGetBlockData(CNode* pfrom, const CChainParams& chainparams, c } } -void static ProcessGetData(CNode* pfrom, const CChainParams& chainparams, CConnman* connman, const CTxMemPool& mempool, const std::atomic<bool>& interruptMsgProc) LOCKS_EXCLUDED(cs_main) +void static ProcessGetData(CNode* pfrom, const CChainParams& chainparams, CConnman* connman, CTxMemPool& mempool, const std::atomic<bool>& interruptMsgProc) LOCKS_EXCLUDED(cs_main) { AssertLockNotHeld(cs_main); @@ -1605,7 +1605,13 @@ void static ProcessGetData(CNode* pfrom, const CChainParams& chainparams, CConnm push = true; } } - if (!push) { + + if (push) { + // We interpret fulfilling a GETDATA for a transaction as a + // successful initial broadcast and remove it from our + // unbroadcast set. + mempool.RemoveUnbroadcastTx(inv.hash); + } else { vNotFound.push_back(inv); } } |