aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2017-01-26 12:35:49 -0500
committerCory Fields <cory-nospam-@coryfields.com>2017-02-02 16:14:16 -0500
commit7a8c2519015650acd51eaf42719f04e53f839bbe (patch)
treea0dde75654c96f4c40654e083217d4c63fc7f747 /src/net_processing.cpp
parent12752af0cc99745d6273ef072645d999c26a9ef7 (diff)
downloadbitcoin-7a8c2519015650acd51eaf42719f04e53f839bbe.tar.xz
net: Disallow sending messages until the version handshake is complete
This is a change in behavior, though it's much more sane now than before.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index d1e6b1ae04..a7acd6edff 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -1277,7 +1277,6 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
// Change version
pfrom->SetSendVersion(nSendVersion);
pfrom->nVersion = nVersion;
- pfrom->fSuccessfullyConnected = true;
if((nServices & NODE_WITNESS))
{
@@ -1387,6 +1386,7 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
nCMPCTBLOCKVersion = 1;
connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::SENDCMPCT, fAnnounceUsingCMPCTBLOCK, nCMPCTBLOCKVersion));
}
+ pfrom->fSuccessfullyConnected = true;
}
@@ -2725,8 +2725,8 @@ bool SendMessages(CNode* pto, CConnman& connman, std::atomic<bool>& interruptMsg
{
const Consensus::Params& consensusParams = Params().GetConsensus();
{
- // Don't send anything until we get its version message
- if (pto->nVersion == 0 || pto->fDisconnect)
+ // Don't send anything until the version handshake is complete
+ if (!pto->fSuccessfullyConnected || pto->fDisconnect)
return true;
// If we get here, the outgoing message serialization version is set and can't change.