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. ensure backward compatible service bits update protocol version to 70004
This commit is contained in:
parent
50b3b35f99
commit
acb08f053a
|
@ -321,6 +321,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||
strUsage += HelpMessageOpt("-proxyrandomize", strprintf(_("Randomize credentials for every proxy connection. This enables Tor stream isolation (default: %u)"), 1));
|
||||
strUsage += HelpMessageOpt("-seednode=<ip>", _("Connect to a node to retrieve peer addresses, and disconnect"));
|
||||
strUsage += HelpMessageOpt("-timeout=<n>", strprintf(_("Specify connection timeout in milliseconds (minimum: 1, default: %d)"), DEFAULT_CONNECT_TIMEOUT));
|
||||
strUsage += HelpMessageOpt("-bloomfilters", _("Allow peers to set bloom filters (default: 1)"));
|
||||
#ifdef USE_UPNP
|
||||
#if USE_UPNP
|
||||
strUsage += HelpMessageOpt("-upnp", _("Use UPnP to map the listening port (default: 1 when listening)"));
|
||||
|
@ -669,6 +670,11 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
fLogTimestamps = GetBoolArg("-logtimestamps", true);
|
||||
fLogIPs = GetBoolArg("-logips", false);
|
||||
|
||||
fBloomFilters = GetBoolArg("-bloomfilters", true);
|
||||
if (fBloomFilters) {
|
||||
nLocalServices |= NODE_BLOOM;
|
||||
}
|
||||
|
||||
// when specifying an explicit binding address, you want to listen on it
|
||||
// even when -connect or -proxy is specified
|
||||
if (mapArgs.count("-bind")) {
|
||||
|
|
|
@ -4684,6 +4684,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")
|
||||
{
|
||||
|
|
|
@ -71,10 +71,16 @@ enum {
|
|||
// set by all Bitcoin Core nodes, and is unset by SPV clients or other peers that just want
|
||||
// network services but don't provide them.
|
||||
NODE_NETWORK = (1 << 0),
|
||||
|
||||
// NODE_BLOOM means the node is capable and willing to handle bloom-filtered connections.
|
||||
// Dogecoin Core will continue to support this by default, but will allow disabling it
|
||||
// with the -bloomfilters option.
|
||||
NODE_BLOOM = (1 << 1),
|
||||
|
||||
// NODE_GETUTXO means the node is capable of responding to the getutxo protocol request.
|
||||
// Bitcoin Core does not support this but a patch set called Bitcoin XT does.
|
||||
// See BIP 64 for details on how this is implemented.
|
||||
NODE_GETUTXO = (1 << 1),
|
||||
NODE_GETUTXO = (1 << 2),
|
||||
|
||||
// Bits 24-31 are reserved for temporary experiments. Just pick a bit that
|
||||
// isn't getting used, or one not being used much, and notify the
|
||||
|
|
|
@ -106,6 +106,8 @@ bool fPrintToDebugLog = true;
|
|||
bool fDaemon = false;
|
||||
bool fServer = false;
|
||||
string strMiscWarning;
|
||||
|
||||
bool fBloomFilters = true;
|
||||
bool fLogTimestamps = false;
|
||||
bool fLogIPs = false;
|
||||
volatile bool fReopenDebugLog = false;
|
||||
|
|
|
@ -43,6 +43,9 @@ extern bool fPrintToConsole;
|
|||
extern bool fPrintToDebugLog;
|
||||
extern bool fServer;
|
||||
extern std::string strMiscWarning;
|
||||
|
||||
|
||||
extern bool fBloomFilters;
|
||||
extern bool fLogTimestamps;
|
||||
extern bool fLogIPs;
|
||||
extern volatile bool fReopenDebugLog;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* network protocol versioning
|
||||
*/
|
||||
|
||||
static const int PROTOCOL_VERSION = 70003;
|
||||
static const int PROTOCOL_VERSION = 70004;
|
||||
|
||||
//! initial proto version, to be increased after version/verack negotiation
|
||||
static const int INIT_PROTO_VERSION = 209;
|
||||
|
|
Loading…
Reference in a new issue