diff options
author | Suhas Daftuar <sdaftuar@gmail.com> | 2020-01-29 10:40:54 -0500 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2020-09-24 13:24:10 +0100 |
commit | 36549376740d28159a5834ecf4ed9eeeeef6715d (patch) | |
tree | 410fcd97494c92e7f66f37efb4a75aefeef621d3 | |
parent | f7833b5bd894aca2d8820402f4a500d71374ea0e (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 3e050bbe4c..b6822d9303 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)); |