aboutsummaryrefslogtreecommitdiff
path: root/src/main.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/main.cpp
parent3764dec36c815267174951a4c64e17c07ee6302f (diff)
downloadbitcoin-fc83f181530fb566726e5f3f4197fc5586d77fd8.tar.xz
Verify that outbound connections have expected services
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index ac89945bf2..7818056d21 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -4616,6 +4616,15 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
{
addrman.SetServices(pfrom->addr, pfrom->nServices);
}
+ if (pfrom->nServicesExpected & ~pfrom->nServices)
+ {
+ LogPrint("net", "peer=%d does not offer the expected services (%08x offered, %08x expected); disconnecting\n", pfrom->id, pfrom->nServices, pfrom->nServicesExpected);
+ pfrom->PushMessage(NetMsgType::REJECT, strCommand, REJECT_NONSTANDARD,
+ strprintf("Expected to offer services %08x", pfrom->nServicesExpected));
+ pfrom->fDisconnect = true;
+ return false;
+ }
+
if (pfrom->nVersion < MIN_PEER_PROTO_VERSION)
{
// disconnect from peers older than this proto version