diff options
| -rw-r--r-- | src/init.cpp | 6 | ||||
| -rw-r--r-- | src/main.cpp | 9 | ||||
| -rw-r--r-- | src/protocol.h | 8 | ||||
| -rw-r--r-- | src/util.cpp | 2 | ||||
| -rw-r--r-- | src/util.h | 3 | ||||
| -rw-r--r-- | src/version.h | 2 |
6 files changed, 28 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp index 21a566848..b8ef781a8 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -321,6 +321,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-proxyrandomize", strprintf(_("Randomize credentials for every proxy connection. This enables Tor stream isolation (default: %u)"), 1)); strUsage += HelpMessageOpt("-seednode=<ip>", _("Connect to a node to retrieve peer addresses, and disconnect")); strUsage += HelpMessageOpt("-timeout=<n>", strprintf(_("Specify connection timeout in milliseconds (minimum: 1, default: %d)"), DEFAULT_CONNECT_TIMEOUT)); + strUsage += HelpMessageOpt("-bloomfilters", _("Allow peers to set bloom filters (default: 1)")); #ifdef USE_UPNP #if USE_UPNP strUsage += HelpMessageOpt("-upnp", _("Use UPnP to map the listening port (default: 1 when listening)")); @@ -669,6 +670,11 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) fLogTimestamps = GetBoolArg("-logtimestamps", true); fLogIPs = GetBoolArg("-logips", false); + fBloomFilters = GetBoolArg("-bloomfilters", true); + if (fBloomFilters) { + nLocalServices |= NODE_BLOOM; + } + // when specifying an explicit binding address, you want to listen on it // even when -connect or -proxy is specified if (mapArgs.count("-bind")) { diff --git a/src/main.cpp b/src/main.cpp index 070b27832..ed32904c6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4691,6 +4691,15 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, } } + else if (!fBloomFilters && + (strCommand == "filterload" || + strCommand == "filteradd" || + strCommand == "filterclear")) + { + pfrom->CloseSocketDisconnect(); + return error("peer %s attempted to set a bloom filter even though we do not advertise that service", + pfrom->addr.ToString().c_str()); + } else if (strCommand == "filterload") { diff --git a/src/protocol.h b/src/protocol.h index b5e65032a..b9e021990 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -71,10 +71,16 @@ enum { // set by all Bitcoin Core nodes, and is unset by SPV clients or other peers that just want // network services but don't provide them. NODE_NETWORK = (1 << 0), + + // NODE_BLOOM means the node is capable and willing to handle bloom-filtered connections. + // Dogecoin Core will continue to support this by default, but will allow disabling it + // with the -bloomfilters option. + NODE_BLOOM = (1 << 1), + // NODE_GETUTXO means the node is capable of responding to the getutxo protocol request. // Bitcoin Core does not support this but a patch set called Bitcoin XT does. // See BIP 64 for details on how this is implemented. - NODE_GETUTXO = (1 << 1), + NODE_GETUTXO = (1 << 2), // Bits 24-31 are reserved for temporary experiments. Just pick a bit that // isn't getting used, or one not being used much, and notify the diff --git a/src/util.cpp b/src/util.cpp index bfb95c904..4fbe66219 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -106,6 +106,8 @@ bool fPrintToDebugLog = true; bool fDaemon = false; bool fServer = false; string strMiscWarning; + +bool fBloomFilters = true; bool fLogTimestamps = false; bool fLogIPs = false; volatile bool fReopenDebugLog = false; diff --git a/src/util.h b/src/util.h index 4cc0faf4d..9b0088d49 100644 --- a/src/util.h +++ b/src/util.h @@ -43,6 +43,9 @@ extern bool fPrintToConsole; extern bool fPrintToDebugLog; extern bool fServer; extern std::string strMiscWarning; + + +extern bool fBloomFilters; extern bool fLogTimestamps; extern bool fLogIPs; extern volatile bool fReopenDebugLog; diff --git a/src/version.h b/src/version.h index 278ddb71e..02ccfd0e1 100644 --- a/src/version.h +++ b/src/version.h @@ -9,7 +9,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 70003; +static const int PROTOCOL_VERSION = 70004; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; |