net_processing: reorder the code that handles the VERSION message
Change the order in which code snippets are executed as a result of receiving the `VERSION` message. Move the snippets that do `MakeAndPushMessage()` near the end. This makes it easier to interrupt the execution when no messages should be sent as a response to the `VERSION` messages, in private broadcast connections. This is a non-functional change.
This commit is contained in:
1 file changed
+13
-13
+13
-13
@@ -3541,19 +3541,6 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
|||||||
pfrom.SetCommonVersion(greatest_common_version);
|
pfrom.SetCommonVersion(greatest_common_version);
|
||||||
pfrom.nVersion = nVersion;
|
pfrom.nVersion = nVersion;
|
||||||
|
|
||||||
if (greatest_common_version >= WTXID_RELAY_VERSION) {
|
|
||||||
MakeAndPushMessage(pfrom, NetMsgType::WTXIDRELAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Signal ADDRv2 support (BIP155).
|
|
||||||
if (greatest_common_version >= 70016) {
|
|
||||||
// BIP155 defines addrv2 and sendaddrv2 for all protocol versions, but some
|
|
||||||
// implementations reject messages they don't know. As a courtesy, don't send
|
|
||||||
// it to nodes with a version before 70016, as no software is known to support
|
|
||||||
// BIP155 that doesn't announce at least that protocol version number.
|
|
||||||
MakeAndPushMessage(pfrom, NetMsgType::SENDADDRV2);
|
|
||||||
}
|
|
||||||
|
|
||||||
pfrom.m_has_all_wanted_services = HasAllDesirableServiceFlags(nServices);
|
pfrom.m_has_all_wanted_services = HasAllDesirableServiceFlags(nServices);
|
||||||
peer->m_their_services = nServices;
|
peer->m_their_services = nServices;
|
||||||
pfrom.SetAddrLocal(addrMe);
|
pfrom.SetAddrLocal(addrMe);
|
||||||
@@ -3580,6 +3567,19 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
|||||||
if (fRelay) pfrom.m_relays_txs = true;
|
if (fRelay) pfrom.m_relays_txs = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (greatest_common_version >= WTXID_RELAY_VERSION) {
|
||||||
|
MakeAndPushMessage(pfrom, NetMsgType::WTXIDRELAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Signal ADDRv2 support (BIP155).
|
||||||
|
if (greatest_common_version >= 70016) {
|
||||||
|
// BIP155 defines addrv2 and sendaddrv2 for all protocol versions, but some
|
||||||
|
// implementations reject messages they don't know. As a courtesy, don't send
|
||||||
|
// it to nodes with a version before 70016, as no software is known to support
|
||||||
|
// BIP155 that doesn't announce at least that protocol version number.
|
||||||
|
MakeAndPushMessage(pfrom, NetMsgType::SENDADDRV2);
|
||||||
|
}
|
||||||
|
|
||||||
if (greatest_common_version >= WTXID_RELAY_VERSION && m_txreconciliation) {
|
if (greatest_common_version >= WTXID_RELAY_VERSION && m_txreconciliation) {
|
||||||
// Per BIP-330, we announce txreconciliation support if:
|
// Per BIP-330, we announce txreconciliation support if:
|
||||||
// - protocol version per the peer's VERSION message supports WTXID_RELAY;
|
// - protocol version per the peer's VERSION message supports WTXID_RELAY;
|
||||||
|
|||||||
Reference in new issue
Block a user