Skip to content

Commit

Permalink
Add a wtxid-index to mapRelay
Browse files Browse the repository at this point in the history
  • Loading branch information
sdaftuar committed Jul 18, 2020
1 parent 60f0acd commit 08b3995
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 08b3995

Please sign in to comment.