Skip to content

Commit 0c27795

Browse files
committed
Merge pull request #6579
afb0cca Add NODE_BLOOM service bit and bump protocol version (Matt Corallo)
2 parents 878ea69 + afb0cca commit 0c27795

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

src/init.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
918918
// Option to startup with mocktime set (used for regression testing):
919919
SetMockTime(GetArg("-mocktime", 0)); // SetMockTime(0) is a no-op
920920

921+
if (GetBoolArg("-peerbloomfilters", true))
922+
nLocalServices |= NODE_BLOOM;
923+
921924
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log
922925

923926
// Initialize elliptic curve code

src/main.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -4591,6 +4591,21 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
45914591
}
45924592

45934593

4594+
else if (!(nLocalServices & NODE_BLOOM) &&
4595+
(strCommand == "filterload" ||
4596+
strCommand == "filteradd" ||
4597+
strCommand == "filterclear") &&
4598+
//TODO: Remove this line after reasonable network upgrade
4599+
pfrom->nVersion >= NO_BLOOM_VERSION)
4600+
{
4601+
if (pfrom->nVersion >= NO_BLOOM_VERSION)
4602+
Misbehaving(pfrom->GetId(), 100);
4603+
//TODO: Enable this after reasonable network upgrade
4604+
//else
4605+
// pfrom->fDisconnect = true;
4606+
}
4607+
4608+
45944609
else if (strCommand == "filterload")
45954610
{
45964611
CBloomFilter filter;

src/protocol.h

+4
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ enum {
7575
// Bitcoin Core does not support this but a patch set called Bitcoin XT does.
7676
// See BIP 64 for details on how this is implemented.
7777
NODE_GETUTXO = (1 << 1),
78+
// NODE_BLOOM means the node is capable and willing to handle bloom-filtered connections.
79+
// Bitcoin Core nodes used to support this by default, without advertising this bit,
80+
// but no longer do as of protocol version 70011 (= NO_BLOOM_VERSION)
81+
NODE_BLOOM = (1 << 2),
7882

7983
// Bits 24-31 are reserved for temporary experiments. Just pick a bit that
8084
// isn't getting used, or one not being used much, and notify the

src/version.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* network protocol versioning
1010
*/
1111

12-
static const int PROTOCOL_VERSION = 70002;
12+
static const int PROTOCOL_VERSION = 70011;
1313

1414
//! initial proto version, to be increased after version/verack negotiation
1515
static const int INIT_PROTO_VERSION = 209;
@@ -34,4 +34,7 @@ static const int BIP0031_VERSION = 60000;
3434
//! "mempool" command, enhanced "getdata" behavior starts with this version
3535
static const int MEMPOOL_GD_VERSION = 60002;
3636

37+
//! "filter*" commands are disabled without NODE_BLOOM after and including this version
38+
static const int NO_BLOOM_VERSION = 70011;
39+
3740
#endif // BITCOIN_VERSION_H

0 commit comments

Comments
 (0)