mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
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.
This commit is contained in:
parent
88d326c8e3
commit
f63f1d3f4b
1 changed files with 10 additions and 0 deletions
|
@ -3414,6 +3414,16 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||||
// they may wish to request compact blocks from us
|
// they may wish to request compact blocks from us
|
||||||
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::SENDCMPCT, /*high_bandwidth=*/false, /*version=*/CMPCTBLOCKS_VERSION));
|
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::SENDCMPCT, /*high_bandwidth=*/false, /*version=*/CMPCTBLOCKS_VERSION));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_txreconciliation) {
|
||||||
|
if (!peer->m_wtxid_relay || !m_txreconciliation->IsPeerRegistered(pfrom.GetId())) {
|
||||||
|
// We could have optimistically pre-registered/registered the peer. In that case,
|
||||||
|
// we should forget about the reconciliation state here if this wasn't followed
|
||||||
|
// by WTXIDRELAY (since WTXIDRELAY can't be announced later).
|
||||||
|
m_txreconciliation->ForgetPeer(pfrom.GetId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pfrom.fSuccessfullyConnected = true;
|
pfrom.fSuccessfullyConnected = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue