aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatt Corallo <git@bluematt.me>2016-12-14 16:41:37 -0800
committerCory Fields <cory-nospam-@coryfields.com>2017-02-02 13:56:05 -0500
commit80ff0344aebbdebdfa7433d855b0aa9de6c4bed3 (patch)
tree586c959f54a062154d05ceed8689ba676f27ddd7 /src
parent1c2edd9f6707d16c03ecfba094b1cfec2ddc4dce (diff)
Dont deserialize nVersion into CNode, should fix #9212
Diffstat (limited to 'src')
-rw-r--r--src/net_processing.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index b9667eb6c6..6dcb907bcf 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -1199,7 +1199,8 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
CAddress addrFrom;
uint64_t nNonce = 1;
uint64_t nServiceInt;
- vRecv >> pfrom->nVersion >> nServiceInt >> nTime >> addrMe;
+ int nVersion;
+ vRecv >> nVersion >> nServiceInt >> nTime >> addrMe;
pfrom->nServices = ServiceFlags(nServiceInt);
if (!pfrom->fInbound)
{
@@ -1214,18 +1215,18 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
return false;
}
- if (pfrom->nVersion < MIN_PEER_PROTO_VERSION)
+ if (nVersion < MIN_PEER_PROTO_VERSION)
{
// disconnect from peers older than this proto version
- LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion);
+ LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, nVersion);
connman.PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE,
strprintf("Version must be %d or greater", MIN_PEER_PROTO_VERSION)));
pfrom->fDisconnect = true;
return false;
}
- if (pfrom->nVersion == 10300)
- pfrom->nVersion = 300;
+ if (nVersion == 10300)
+ nVersion = 300;
if (!vRecv.empty())
vRecv >> addrFrom >> nNonce;
if (!vRecv.empty()) {
@@ -1277,7 +1278,8 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
// Change version
connman.PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::VERACK));
- int nSendVersion = std::min(pfrom->nVersion, PROTOCOL_VERSION);
+ int nSendVersion = std::min(nVersion, PROTOCOL_VERSION);
+ pfrom->nVersion = nVersion;
pfrom->SetSendVersion(nSendVersion);
if (!pfrom->fInbound)