aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 50aea0fd0b..835095f4d0 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -2055,6 +2055,10 @@ bool ProcessMessage(CNode* pfrom, const std::string& msg_type, CDataStream& vRec
if (pfrom->fInbound)
PushNodeVersion(pfrom, connman, GetAdjustedTime());
+ if (nVersion >= WTXID_RELAY_VERSION) {
+ connman->PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::WTXIDRELAY));
+ }
+
connman->PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::VERACK));
pfrom->nServices = nServices;
@@ -2194,6 +2198,18 @@ bool ProcessMessage(CNode* pfrom, const std::string& msg_type, CDataStream& vRec
return true;
}
+ // Feature negotiation of wtxidrelay should happen between VERSION and
+ // VERACK, to avoid relay problems from switching after a connection is up
+ if (msg_type == NetMsgType::WTXIDRELAY) {
+ if (pfrom->nVersion >= WTXID_RELAY_VERSION) {
+ LOCK(cs_main);
+ if (!State(pfrom->GetId())->m_wtxid_relay) {
+ State(pfrom->GetId())->m_wtxid_relay = true;
+ }
+ }
+ return false;
+ }
+
if (!pfrom->fSuccessfullyConnected) {
// Must have a verack message before anything else
LOCK(cs_main);