mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
[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.
This commit is contained in:
parent
ff8c430c65
commit
3a10d935ac
1 changed files with 8 additions and 14 deletions
|
@ -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) {
|
if (msg_type == NetMsgType::VERSION) {
|
||||||
// Each connection can only send one version message
|
// Each connection can only send one version message
|
||||||
if (pfrom.nVersion != 0)
|
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 (msg_type == NetMsgType::FILTERLOAD) {
|
||||||
|
if (!(pfrom.GetLocalServices() & NODE_BLOOM)) {
|
||||||
|
pfrom.fDisconnect = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
CBloomFilter filter;
|
CBloomFilter filter;
|
||||||
vRecv >> filter;
|
vRecv >> filter;
|
||||||
|
|
||||||
|
@ -3466,6 +3456,10 @@ bool ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRec
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg_type == NetMsgType::FILTERADD) {
|
if (msg_type == NetMsgType::FILTERADD) {
|
||||||
|
if (!(pfrom.GetLocalServices() & NODE_BLOOM)) {
|
||||||
|
pfrom.fDisconnect = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
std::vector<unsigned char> vData;
|
std::vector<unsigned char> vData;
|
||||||
vRecv >> vData;
|
vRecv >> vData;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue