Skip to content

Commit 3a10d93

Browse files
committed
[p2p/refactor] move disconnect logic and remove misbehaving
-Increasing the banscore and/or banning is too harsh, just disconnecting is enough. -Return true from ProcessMessage because we already log receipt of filterclear and disconnect.
1 parent ff8c430 commit 3a10d93

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

src/net_processing.cpp

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,20 +2215,6 @@ bool ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRec
22152215
}
22162216

22172217

2218-
if (!(pfrom.GetLocalServices() & NODE_BLOOM) &&
2219-
(msg_type == NetMsgType::FILTERLOAD ||
2220-
msg_type == NetMsgType::FILTERADD))
2221-
{
2222-
if (pfrom.nVersion >= NO_BLOOM_VERSION) {
2223-
LOCK(cs_main);
2224-
Misbehaving(pfrom.GetId(), 100);
2225-
return false;
2226-
} else {
2227-
pfrom.fDisconnect = true;
2228-
return false;
2229-
}
2230-
}
2231-
22322218
if (msg_type == NetMsgType::VERSION) {
22332219
// Each connection can only send one version message
22342220
if (pfrom.nVersion != 0)
@@ -3447,6 +3433,10 @@ bool ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRec
34473433
}
34483434

34493435
if (msg_type == NetMsgType::FILTERLOAD) {
3436+
if (!(pfrom.GetLocalServices() & NODE_BLOOM)) {
3437+
pfrom.fDisconnect = true;
3438+
return true;
3439+
}
34503440
CBloomFilter filter;
34513441
vRecv >> filter;
34523442

@@ -3466,6 +3456,10 @@ bool ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRec
34663456
}
34673457

34683458
if (msg_type == NetMsgType::FILTERADD) {
3459+
if (!(pfrom.GetLocalServices() & NODE_BLOOM)) {
3460+
pfrom.fDisconnect = true;
3461+
return true;
3462+
}
34693463
std::vector<unsigned char> vData;
34703464
vRecv >> vData;
34713465

0 commit comments

Comments
 (0)