diff --git a/src/init.cpp b/src/init.cpp index 72b53ebec..c8f0f4082 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -412,6 +412,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 01a1babc7..bc34075c8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3931,6 +3931,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 3d8eae55f..845c5fd63 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -60,6 +60,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 71994587c..3897e3c97 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -79,6 +79,7 @@ bool fPrintToDebugger = false; bool fDaemon = false; bool fServer = false; string strMiscWarning; +bool fBloomFilters = true; bool fNoListen = false; bool fLogTimestamps = false; CMedianFilter vTimeOffsets(200,0); diff --git a/src/util.h b/src/util.h index 258910e2f..bfec63b6b 100644 --- a/src/util.h +++ b/src/util.h @@ -146,6 +146,7 @@ extern bool fPrintToDebugger; extern bool fDaemon; 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 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;