diff options
author | Suhas Daftuar <sdaftuar@gmail.com> | 2020-01-29 10:40:54 -0500 |
---|---|---|
committer | Suhas Daftuar <sdaftuar@gmail.com> | 2020-07-18 19:00:02 -0400 |
commit | 08b39955ec7f84e835ab0b1366f0dd28dfd6ce03 (patch) | |
tree | 6750addfaa29efb66df8e5a5ca05c8942363fbb0 | |
parent | 60f0acda713e7b9dc188aef54ef93981a93f4e44 (diff) |
Add a wtxid-index to mapRelay
-rw-r--r-- | src/net_processing.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 1373338cf3..7dd8da307c 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -4246,6 +4246,11 @@ bool PeerLogicValidation::SendMessages(CNode* pto) if (ret.second) { vRelayExpiration.push_back(std::make_pair(nNow + std::chrono::microseconds{RELAY_TX_CACHE_TIME}.count(), ret.first)); } + // Add wtxid-based lookup into mapRelay as well, so that peers can request by wtxid + auto ret2 = mapRelay.emplace(ret.first->second->GetWitnessHash(), ret.first->second); + if (ret2.second) { + vRelayExpiration.emplace_back(nNow + std::chrono::microseconds{RELAY_TX_CACHE_TIME}.count(), ret2.first); + } } if (vInv.size() == MAX_INV_SZ) { connman->PushMessage(pto, msgMaker.Make(NetMsgType::INV, vInv)); |