mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 15:50:07 +01:00
net_processing: make all Misbehaving increments = 100
This removes the need to actually track misbehavior score (see further commit), because any Misbehaving node will immediately hit the discouragement threshold.
This commit is contained in:
@@ -1949,8 +1949,7 @@ bool PeerManagerImpl::MaybePunishNodeForBlock(NodeId nodeid, const BlockValidati
|
||||
return true;
|
||||
// Conflicting (but not necessarily invalid) data or different policy:
|
||||
case BlockValidationResult::BLOCK_MISSING_PREV:
|
||||
// TODO: Handle this much more gracefully (10 DoS points is super arbitrary)
|
||||
if (peer) Misbehaving(*peer, 10, message);
|
||||
if (peer) Misbehaving(*peer, 100, message);
|
||||
return true;
|
||||
case BlockValidationResult::BLOCK_RECENT_CONSENSUS_CHANGE:
|
||||
case BlockValidationResult::BLOCK_TIME_FUTURE:
|
||||
@@ -2690,7 +2689,7 @@ bool PeerManagerImpl::CheckHeadersPoW(const std::vector<CBlockHeader>& headers,
|
||||
|
||||
// Are these headers connected to each other?
|
||||
if (!CheckHeadersAreContinuous(headers)) {
|
||||
Misbehaving(peer, 20, "non-continuous headers sequence");
|
||||
Misbehaving(peer, 100, "non-continuous headers sequence");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -4107,7 +4106,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||
|
||||
if (vAddr.size() > MAX_ADDR_TO_SEND)
|
||||
{
|
||||
Misbehaving(*peer, 20, strprintf("%s message size = %u", msg_type, vAddr.size()));
|
||||
Misbehaving(*peer, 100, strprintf("%s message size = %u", msg_type, vAddr.size()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4189,7 +4188,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||
vRecv >> vInv;
|
||||
if (vInv.size() > MAX_INV_SZ)
|
||||
{
|
||||
Misbehaving(*peer, 20, strprintf("inv message size = %u", vInv.size()));
|
||||
Misbehaving(*peer, 100, strprintf("inv message size = %u", vInv.size()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4281,7 +4280,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||
vRecv >> vInv;
|
||||
if (vInv.size() > MAX_INV_SZ)
|
||||
{
|
||||
Misbehaving(*peer, 20, strprintf("getdata message size = %u", vInv.size()));
|
||||
Misbehaving(*peer, 100, strprintf("getdata message size = %u", vInv.size()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4966,7 +4965,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||
// Bypass the normal CBlock deserialization, as we don't want to risk deserializing 2000 full blocks.
|
||||
unsigned int nCount = ReadCompactSize(vRecv);
|
||||
if (nCount > MAX_HEADERS_RESULTS) {
|
||||
Misbehaving(*peer, 20, strprintf("headers message size = %u", nCount));
|
||||
Misbehaving(*peer, 100, strprintf("headers message size = %u", nCount));
|
||||
return;
|
||||
}
|
||||
headers.resize(nCount);
|
||||
|
||||
Reference in New Issue
Block a user