diff --git a/src/init.cpp b/src/init.cpp index 39039ac0e..fdffca6f8 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -219,6 +219,7 @@ std::string HelpMessage(HelpMessageMode hmm) strUsage += " -bantime= " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") + "\n"; strUsage += " -maxreceivebuffer= " + _("Maximum per-connection receive buffer, *1000 bytes (default: 5000)") + "\n"; strUsage += " -maxsendbuffer= " + _("Maximum per-connection send buffer, *1000 bytes (default: 1000)") + "\n"; + strUsage += " -bloomfilters " + _("Allow peers to set bloom filters (default: 1)") + "\n" + #ifdef USE_UPNP #if USE_UPNP strUsage += " -upnp " + _("Use UPnP to map the listening port (default: 1 when listening)") + "\n"; @@ -419,6 +420,11 @@ bool AppInit2(boost::thread_group& threadGroup) // ********************************************************* Step 2: parameter interactions + fBloomFilters = GetBoolArg("-bloomfilters", true); + if (fBloomFilters) { + nLocalServices |= NODE_BLOOM; + } + if (mapArgs.count("-bind")) { // when specifying an explicit binding address, you want to listen on it // even when -connect or -proxy is specified diff --git a/src/main.cpp b/src/main.cpp index 536e67ab9..4ad43fbce 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4015,6 +4015,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/util.cpp b/src/util.cpp index 17f4dc3d3..44d2d3d30 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -94,6 +94,7 @@ bool fPrintToDebugLog = true; bool fDaemon = false; bool fServer = false; string strMiscWarning; +bool fBloomFilters = true; bool fNoListen = false; bool fLogTimestamps = false; volatile bool fReopenDebugLog = false; diff --git a/src/util.h b/src/util.h index ef4098156..b92ceaf00 100644 --- a/src/util.h +++ b/src/util.h @@ -114,6 +114,7 @@ extern bool fPrintToConsole; extern bool fPrintToDebugLog; extern bool fServer; extern std::string strMiscWarning; +extern bool fBloomFilters; extern bool fNoListen; extern bool fLogTimestamps; extern volatile bool fReopenDebugLog; diff --git a/src/version.h b/src/version.h index c0d104fba..adddb2d36 100644 --- a/src/version.h +++ b/src/version.h @@ -27,7 +27,7 @@ extern const std::string CLIENT_DATE; // network protocol versioning // -static const int PROTOCOL_VERSION = 70001; +static const int PROTOCOL_VERSION = 70002; // intial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209;