Skip to content

Commit

Permalink
net: simplify fRelayTxes flag processing
Browse files Browse the repository at this point in the history
  • Loading branch information
furszy committed Nov 22, 2021
1 parent 71667df commit 8c02b59
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/net_processing.cpp
Expand Up @@ -1115,6 +1115,7 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
std::string strSubVer;
std::string cleanSubVer;
int nStartingHeight = -1;
bool fRelay = true;
vRecv >> nVersion >> nServiceInt >> nTime >> addrMe;
nSendVersion = std::min(nVersion, PROTOCOL_VERSION);
nServices = ServiceFlags(nServiceInt);
Expand Down Expand Up @@ -1142,6 +1143,9 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
if (!vRecv.empty()) {
vRecv >> nStartingHeight;
}
if (!vRecv.empty()) {
vRecv >> fRelay;
}

// Disconnect if we connected to ourself
if (pfrom->fInbound && !connman->CheckIncomingNonce(nNonce)) {
Expand Down Expand Up @@ -1183,11 +1187,7 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR

{
LOCK(pfrom->cs_filter);
if (!vRecv.empty()) {
vRecv >> pfrom->fRelayTxes; // set to true after we get the first filter* message
} else {
pfrom->fRelayTxes = true;
}
pfrom->fRelayTxes = fRelay; // set to true after we get the first filter* message
}

// Change version
Expand Down

0 comments on commit 8c02b59

Please sign in to comment.