mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-12 11:19:08 -05:00
doc: refer to BIPs 339/155 in feature negotiation
and add fSuccessfullyConnected doxygen documentation to clarify that it is set to true on VERACK
This commit is contained in:
parent
384e090f93
commit
e1e6714832
2 changed files with 7 additions and 6 deletions
|
@ -445,6 +445,7 @@ public:
|
||||||
* messages, implying a preference to receive ADDRv2 instead of ADDR ones.
|
* messages, implying a preference to receive ADDRv2 instead of ADDR ones.
|
||||||
*/
|
*/
|
||||||
std::atomic_bool m_wants_addrv2{false};
|
std::atomic_bool m_wants_addrv2{false};
|
||||||
|
/** fSuccessfullyConnected is set to true on receiving VERACK from the peer. */
|
||||||
std::atomic_bool fSuccessfullyConnected{false};
|
std::atomic_bool fSuccessfullyConnected{false};
|
||||||
// Setting fDisconnect to true will cause the node to be disconnected the
|
// Setting fDisconnect to true will cause the node to be disconnected the
|
||||||
// next time DisconnectNodes() runs
|
// next time DisconnectNodes() runs
|
||||||
|
|
|
@ -2745,12 +2745,11 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Feature negotiation of wtxidrelay must happen between VERSION and VERACK
|
// BIP339 defines feature negotiation of wtxidrelay, which must happen between
|
||||||
// to avoid relay problems from switching after a connection is up.
|
// VERSION and VERACK to avoid relay problems from switching after a connection is up.
|
||||||
if (msg_type == NetMsgType::WTXIDRELAY) {
|
if (msg_type == NetMsgType::WTXIDRELAY) {
|
||||||
if (pfrom.fSuccessfullyConnected) {
|
if (pfrom.fSuccessfullyConnected) {
|
||||||
// Disconnect peers that send wtxidrelay message after VERACK; this
|
// Disconnect peers that send a wtxidrelay message after VERACK.
|
||||||
// must be negotiated between VERSION and VERACK.
|
|
||||||
LogPrint(BCLog::NET, "wtxidrelay received after verack from peer=%d; disconnecting\n", pfrom.GetId());
|
LogPrint(BCLog::NET, "wtxidrelay received after verack from peer=%d; disconnecting\n", pfrom.GetId());
|
||||||
pfrom.fDisconnect = true;
|
pfrom.fDisconnect = true;
|
||||||
return;
|
return;
|
||||||
|
@ -2769,10 +2768,11 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BIP155 defines feature negotiation of addrv2 and sendaddrv2, which must happen
|
||||||
|
// between VERSION and VERACK.
|
||||||
if (msg_type == NetMsgType::SENDADDRV2) {
|
if (msg_type == NetMsgType::SENDADDRV2) {
|
||||||
if (pfrom.fSuccessfullyConnected) {
|
if (pfrom.fSuccessfullyConnected) {
|
||||||
// Disconnect peers that send SENDADDRV2 message after VERACK; this
|
// Disconnect peers that send a SENDADDRV2 message after VERACK.
|
||||||
// must be negotiated between VERSION and VERACK.
|
|
||||||
LogPrint(BCLog::NET, "sendaddrv2 received after verack from peer=%d; disconnecting\n", pfrom.GetId());
|
LogPrint(BCLog::NET, "sendaddrv2 received after verack from peer=%d; disconnecting\n", pfrom.GetId());
|
||||||
pfrom.fDisconnect = true;
|
pfrom.fDisconnect = true;
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue