Skip to content

Commit b3caa9b

Browse files
committed
Move bloom filter filtering logic outside of command "switch" (giant if/else).
Moving this logic outside of the "switch" makes it far simpler to enable the forced disconnect by a parameter.
1 parent 0b0fc17 commit b3caa9b

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/main.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3989,6 +3989,21 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
39893989
}
39903990

39913991

3992+
if (!(nLocalServices & NODE_BLOOM) &&
3993+
(strCommand == "filterload" ||
3994+
strCommand == "filteradd" ||
3995+
strCommand == "filterclear"))
3996+
{
3997+
if (pfrom->nVersion >= NO_BLOOM_VERSION) {
3998+
Misbehaving(pfrom->GetId(), 100);
3999+
return false;
4000+
}
4001+
//TODO: Enable this after reasonable network upgrade
4002+
//else {
4003+
// pfrom->fDisconnect = true;
4004+
// return false;
4005+
//}
4006+
}
39924007

39934008

39944009
if (strCommand == "version")
@@ -4750,21 +4765,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
47504765
}
47514766

47524767

4753-
else if (!(nLocalServices & NODE_BLOOM) &&
4754-
(strCommand == "filterload" ||
4755-
strCommand == "filteradd" ||
4756-
strCommand == "filterclear") &&
4757-
//TODO: Remove this line after reasonable network upgrade
4758-
pfrom->nVersion >= NO_BLOOM_VERSION)
4759-
{
4760-
if (pfrom->nVersion >= NO_BLOOM_VERSION)
4761-
Misbehaving(pfrom->GetId(), 100);
4762-
//TODO: Enable this after reasonable network upgrade
4763-
//else
4764-
// pfrom->fDisconnect = true;
4765-
}
4766-
4767-
47684768
else if (strCommand == "filterload")
47694769
{
47704770
CBloomFilter filter;

0 commit comments

Comments
 (0)