mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
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-70011 nodes. Also adds an option to turn bloom filter support off for nodes which advertise a version number >= 70011. 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. Implements BIP 111
This commit is contained in:
15
src/main.cpp
15
src/main.cpp
@@ -4591,6 +4591,21 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
}
|
||||
|
||||
|
||||
else if (!(nLocalServices & NODE_BLOOM) &&
|
||||
(strCommand == "filterload" ||
|
||||
strCommand == "filteradd" ||
|
||||
strCommand == "filterclear") &&
|
||||
//TODO: Remove this line after reasonable network upgrade
|
||||
pfrom->nVersion >= NO_BLOOM_VERSION)
|
||||
{
|
||||
if (pfrom->nVersion >= NO_BLOOM_VERSION)
|
||||
Misbehaving(pfrom->GetId(), 100);
|
||||
//TODO: Enable this after reasonable network upgrade
|
||||
//else
|
||||
// pfrom->fDisconnect = true;
|
||||
}
|
||||
|
||||
|
||||
else if (strCommand == "filterload")
|
||||
{
|
||||
CBloomFilter filter;
|
||||
|
||||
Reference in New Issue
Block a user