Skip to content

Commit f63f1d3

Browse files
committed
p2p: clear txreconciliation state for non-wtxid peers
We optimistically pre-register a peer for txreconciliations upon sending txreconciliation support announcement. But if, at VERACK, we realize that the peer never sent WTXIDRELAY message, we should unregister the peer from txreconciliations, because txreconciliations rely on wtxids.
1 parent 88d326c commit f63f1d3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/net_processing.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3414,6 +3414,16 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
34143414
// they may wish to request compact blocks from us
34153415
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::SENDCMPCT, /*high_bandwidth=*/false, /*version=*/CMPCTBLOCKS_VERSION));
34163416
}
3417+
3418+
if (m_txreconciliation) {
3419+
if (!peer->m_wtxid_relay || !m_txreconciliation->IsPeerRegistered(pfrom.GetId())) {
3420+
// We could have optimistically pre-registered/registered the peer. In that case,
3421+
// we should forget about the reconciliation state here if this wasn't followed
3422+
// by WTXIDRELAY (since WTXIDRELAY can't be announced later).
3423+
m_txreconciliation->ForgetPeer(pfrom.GetId());
3424+
}
3425+
}
3426+
34173427
pfrom.fSuccessfullyConnected = true;
34183428
return;
34193429
}

0 commit comments

Comments
 (0)