Browse Source

Add NODE_BLOOM service bit and option to disable bloom filters

0.8
Peter Todd 11 years ago committed by Warren Togami
parent
commit
176e54c5f7
  1. 4
      src/init.cpp
  2. 10
      src/main.cpp
  3. 1
      src/protocol.h
  4. 1
      src/util.cpp
  5. 1
      src/util.h
  6. 2
      src/version.h

4
src/init.cpp

@ -315,6 +315,7 @@ std::string HelpMessage()
" -bantime=<n> " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") + "\n" + " -bantime=<n> " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") + "\n" +
" -maxreceivebuffer=<n> " + _("Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)") + "\n" + " -maxreceivebuffer=<n> " + _("Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)") + "\n" +
" -maxsendbuffer=<n> " + _("Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)") + "\n" + " -maxsendbuffer=<n> " + _("Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)") + "\n" +
" -bloomfilters " + _("Allow peers to set bloom filters (default: 0)") + "\n" +
#ifdef USE_UPNP #ifdef USE_UPNP
#if USE_UPNP #if USE_UPNP
" -upnp " + _("Use UPnP to map the listening port (default: 1 when listening)") + "\n" + " -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 // ********************************************************* Step 2: parameter interactions
fTestNet = GetBoolArg("-testnet"); fTestNet = GetBoolArg("-testnet");
fBloomFilters = GetBoolArg("-bloomfilters");
if (fBloomFilters)
nLocalServices |= NODE_BLOOM;
if (mapArgs.count("-bind")) { if (mapArgs.count("-bind")) {
// when specifying an explicit binding address, you want to listen on it // when specifying an explicit binding address, you want to listen on it

10
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") else if (strCommand == "filterload")
{ {
CBloomFilter filter; CBloomFilter filter;

1
src/protocol.h

@ -69,6 +69,7 @@ class CMessageHeader
enum enum
{ {
NODE_NETWORK = (1 << 0), NODE_NETWORK = (1 << 0),
NODE_BLOOM = (1 << 1),
}; };
/** A CService with information about it as peer */ /** A CService with information about it as peer */

1
src/util.cpp

@ -79,6 +79,7 @@ bool fServer = false;
bool fCommandLine = false; bool fCommandLine = false;
string strMiscWarning; string strMiscWarning;
bool fTestNet = false; bool fTestNet = false;
bool fBloomFilters = false;
bool fNoListen = false; bool fNoListen = false;
bool fLogTimestamps = false; bool fLogTimestamps = false;
CMedianFilter<int64> vTimeOffsets(200,0); CMedianFilter<int64> vTimeOffsets(200,0);

1
src/util.h

@ -144,6 +144,7 @@ extern bool fServer;
extern bool fCommandLine; extern bool fCommandLine;
extern std::string strMiscWarning; extern std::string strMiscWarning;
extern bool fTestNet; extern bool fTestNet;
extern bool fBloomFilters;
extern bool fNoListen; extern bool fNoListen;
extern bool fLogTimestamps; extern bool fLogTimestamps;
extern volatile bool fReopenDebugLog; extern volatile bool fReopenDebugLog;

2
src/version.h

@ -25,7 +25,7 @@ extern const std::string CLIENT_DATE;
// network protocol versioning // 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 // earlier versions not supported as of Feb 2012, and are disconnected
static const int MIN_PROTO_VERSION = 209; static const int MIN_PROTO_VERSION = 209;

Loading…
Cancel
Save