From 19a6f718d34ef607db566972ed2b73d44737bab7 Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Thu, 6 Dec 2018 08:07:33 +0100 Subject: [PATCH] Don't respond with getdata for legacy inv types when spork15 is active (#2528) Avoid unnecessary traffic from non-upgraded nodes. --- src/net_processing.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 2e45b65dd..6cfa51662 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1786,6 +1786,18 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr } else { + static std::set legacyMNObjs = { + MSG_MASTERNODE_PAYMENT_VOTE, + MSG_MASTERNODE_PAYMENT_BLOCK, + MSG_MASTERNODE_ANNOUNCE, + MSG_MASTERNODE_PING, + MSG_MASTERNODE_VERIFY, + }; + if (legacyMNObjs.count(inv.type) && deterministicMNManager->IsDeterministicMNsSporkActive()) { + LogPrint("net", "ignoring (%s) inv of legacy type %d peer=%d\n", inv.hash.ToString(), inv.type, pfrom->id); + continue; + } + pfrom->AddInventoryKnown(inv); if (fBlocksOnly) LogPrint("net", "transaction (%s) inv sent in violation of protocol peer=%d\n", inv.hash.ToString(), pfrom->id);