diff --git a/src/init.cpp b/src/init.cpp index 2145d29fe..5ae4a80eb 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -315,6 +315,7 @@ std::string HelpMessage() " -bantime= " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") + "\n" + " -maxreceivebuffer= " + _("Maximum per-connection receive buffer, *1000 bytes (default: 5000)") + "\n" + " -maxsendbuffer= " + _("Maximum per-connection send buffer, *1000 bytes (default: 1000)") + "\n" + + " -bloomfilters " + _("Allow peers to set bloom filters (default: 0)") + "\n" + #ifdef USE_UPNP #if USE_UPNP " -upnp " + _("Use UPnP to map the listening port (default: 1 when listening)") + "\n" + @@ -494,6 +495,9 @@ bool AppInit2(boost::thread_group& threadGroup) // ********************************************************* Step 2: parameter interactions fTestNet = GetBoolArg("-testnet"); + fBloomFilters = GetBoolArg("-bloomfilters"); + if (fBloomFilters) + nLocalServices |= NODE_BLOOM; if (mapArgs.count("-bind")) { // when specifying an explicit binding address, you want to listen on it diff --git a/src/main.cpp b/src/main.cpp index 17f94b857..5f01875ce 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3692,6 +3692,16 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) } + else if (!fBloomFilters && + (strCommand == "filterload" || + strCommand == "filteradd" || + strCommand == "filterclear")) + { + pfrom->Misbehaving(100); + 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") { CBloomFilter filter; diff --git a/src/protocol.h b/src/protocol.h index 35cf156d6..a6726dd34 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -69,6 +69,7 @@ class CMessageHeader enum { NODE_NETWORK = (1 << 0), + NODE_BLOOM = (1 << 1), }; /** A CService with information about it as peer */ diff --git a/src/util.cpp b/src/util.cpp index d72a566e7..321bd25b9 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -79,6 +79,7 @@ bool fServer = false; bool fCommandLine = false; string strMiscWarning; bool fTestNet = false; +bool fBloomFilters = false; bool fNoListen = false; bool fLogTimestamps = false; CMedianFilter vTimeOffsets(200,0); diff --git a/src/util.h b/src/util.h index 2be01e19f..130933d1f 100644 --- a/src/util.h +++ b/src/util.h @@ -144,6 +144,7 @@ extern bool fServer; extern bool fCommandLine; extern std::string strMiscWarning; extern bool fTestNet; +extern bool fBloomFilters; extern bool fNoListen; extern bool fLogTimestamps; extern volatile bool fReopenDebugLog; diff --git a/src/version.h b/src/version.h index f1e7c4cd7..281159b97 100644 --- a/src/version.h +++ b/src/version.h @@ -25,7 +25,7 @@ extern const std::string CLIENT_DATE; // network protocol versioning // -static const int PROTOCOL_VERSION = 70001; +static const int PROTOCOL_VERSION = 70002; // earlier versions not supported as of Feb 2012, and are disconnected static const int MIN_PROTO_VERSION = 209;