Skip to content

Commit 08b3995

Browse files
committed
Add a wtxid-index to mapRelay
1 parent 60f0acd commit 08b3995

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/net_processing.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -4246,6 +4246,11 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
42464246
if (ret.second) {
42474247
vRelayExpiration.push_back(std::make_pair(nNow + std::chrono::microseconds{RELAY_TX_CACHE_TIME}.count(), ret.first));
42484248
}
4249+
// Add wtxid-based lookup into mapRelay as well, so that peers can request by wtxid
4250+
auto ret2 = mapRelay.emplace(ret.first->second->GetWitnessHash(), ret.first->second);
4251+
if (ret2.second) {
4252+
vRelayExpiration.emplace_back(nNow + std::chrono::microseconds{RELAY_TX_CACHE_TIME}.count(), ret2.first);
4253+
}
42494254
}
42504255
if (vInv.size() == MAX_INV_SZ) {
42514256
connman->PushMessage(pto, msgMaker.Make(NetMsgType::INV, vInv));

0 commit comments

Comments
 (0)