Add NODE_BLOOM service bit and bump protocol version
Lets nodes advertise that they offer bloom filter support explicitly. The protocol version bump allows SPV nodes to assume that NODE_BLOOM is set if NODE_NETWORK is set for pre-70002 nodes. Also adds an undocumented option to turn bloom filter support off for testing purposes. Nodes attempting to use bloom filters are immediately dropped so as to not waste their bandwidth.
This commit is contained in:
parent
0d09b3e8b0
commit
e7a64af74f
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
{
|
||||
|
|
|
@ -60,6 +60,7 @@ class CMessageHeader
|
|||
enum
|
||||
{
|
||||
NODE_NETWORK = (1 << 0),
|
||||
NODE_BLOOM = (1 << 1),
|
||||
};
|
||||
|
||||
/** A CService with information about it as peer */
|
||||
|
|
|
@ -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<int64> vTimeOffsets(200,0);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue