aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2016-03-26 19:09:22 +0100
committerPieter Wuille <pieter.wuille@gmail.com>2016-06-13 17:40:16 +0200
commitfc83f181530fb566726e5f3f4197fc5586d77fd8 (patch)
treef30fb7b98a910a7f28f6317b32d35591cfaad1a7 /src/net.cpp
parent3764dec36c815267174951a4c64e17c07ee6302f (diff)
downloadbitcoin-fc83f181530fb566726e5f3f4197fc5586d77fd8.tar.xz
Verify that outbound connections have expected services
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 173eba57c8..a0c2bd5091 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -71,6 +71,9 @@ namespace {
const static std::string NET_MESSAGE_COMMAND_OTHER = "*other*";
+/** Services this node implementation cares about */
+static const uint64_t nRelevantServices = NODE_NETWORK;
+
//
// Global state variables
//
@@ -409,6 +412,7 @@ CNode* ConnectNode(CAddress addrConnect, const char *pszDest, bool fCountFailure
vNodes.push_back(pnode);
}
+ pnode->nServicesExpected = addrConnect.nServices & nRelevantServices;
pnode->nTimeConnected = GetTime();
return pnode;
@@ -2325,6 +2329,7 @@ CNode::CNode(SOCKET hSocketIn, const CAddress& addrIn, const std::string& addrNa
filterInventoryKnown(50000, 0.000001)
{
nServices = 0;
+ nServicesExpected = 0;
hSocket = hSocketIn;
nRecvVersion = INIT_PROTO_VERSION;
nLastSend = 0;