Merge pull request #361 from leofidus/bloom-todd

Advertise Bloom filtering in 1.7
This commit is contained in:
langerhans 2014-03-23 22:08:36 +01:00
commit 61b2bc8e3e
5 changed files with 18 additions and 1 deletions

View file

@ -219,6 +219,7 @@ std::string HelpMessage(HelpMessageMode hmm)
strUsage += " -bantime=<n> " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") + "\n";
strUsage += " -maxreceivebuffer=<n> " + _("Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)") + "\n";
strUsage += " -maxsendbuffer=<n> " + _("Maximum per-connection send buffer, <n>*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

View file

@ -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")
{

View file

@ -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;

View file

@ -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;

View file

@ -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;