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-170004 nodes.

Also adds an option to turn bloom filter support off for nodes which
advertise a version number >= 170004. Nodes attempting to use bloom
filters on such protocol versions are banned, and a later upgade
should drop nodes of an older version which attempt to use bloom
filters.

Much code stolen from Peter Todd.

Zcash: Implements Zcash equivalent of BIP 111; deploys with Overwinter
This commit is contained in:
Matt Corallo
2015-08-20 21:15:27 -07:00
committed by Jack Grigg
parent f5b1082f9c
commit 8bc4461326
4 changed files with 26 additions and 1 deletions

View File

@@ -71,6 +71,10 @@ 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.
// Zcash nodes used to support this by default, without advertising this bit,
// but no longer do as of protocol version 170004 (= NO_BLOOM_VERSION)
NODE_BLOOM = (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