From 36549376740d28159a5834ecf4ed9eeeeef6715d Mon Sep 17 00:00:00 2001 From: Suhas Daftuar Date: Wed, 29 Jan 2020 10:40:54 -0500 Subject: [PATCH] Add a wtxid-index to mapRelay --- src/net_processing.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 3e050bbe4cc..b6822d93032 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -3932,6 +3932,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));