diff options
author | gzhao408 <gzhao408@berkeley.edu> | 2020-06-12 13:21:18 -0700 |
---|---|---|
committer | gzhao408 <gzhao408@berkeley.edu> | 2020-06-14 11:48:17 -0700 |
commit | 3a10d935ac8ebabdfd336569d943f042ff84b13e (patch) | |
tree | be4be5c44d6308011246c5f39c1756bf0a558015 | |
parent | ff8c430c6589ea72b9e169455cf6437c8623cc52 (diff) |
[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.
-rw-r--r-- | src/net_processing.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 8e8a84e4e2..aa5c9668e3 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2215,20 +2215,6 @@ bool ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRec } - if (!(pfrom.GetLocalServices() & NODE_BLOOM) && - (msg_type == NetMsgType::FILTERLOAD || - msg_type == NetMsgType::FILTERADD)) - { - if (pfrom.nVersion >= NO_BLOOM_VERSION) { - LOCK(cs_main); - Misbehaving(pfrom.GetId(), 100); - return false; - } else { - pfrom.fDisconnect = true; - return false; - } - } - if (msg_type == NetMsgType::VERSION) { // Each connection can only send one version message if (pfrom.nVersion != 0) @@ -3447,6 +3433,10 @@ bool ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRec } if (msg_type == NetMsgType::FILTERLOAD) { + if (!(pfrom.GetLocalServices() & NODE_BLOOM)) { + pfrom.fDisconnect = true; + return true; + } CBloomFilter filter; vRecv >> filter; @@ -3466,6 +3456,10 @@ bool ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRec } if (msg_type == NetMsgType::FILTERADD) { + if (!(pfrom.GetLocalServices() & NODE_BLOOM)) { + pfrom.fDisconnect = true; + return true; + } std::vector<unsigned char> vData; vRecv >> vData; |