Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 1,160 Lines • ▼ Show 20 Lines | while (mapOrphanTransactions.size() > nMaxOrphans) { | ||||
++nEvicted; | ++nEvicted; | ||||
} | } | ||||
return nEvicted; | return nEvicted; | ||||
} | } | ||||
/** | /** | ||||
* Mark a misbehaving peer to be banned depending upon the value of `-banscore`. | * Mark a misbehaving peer to be banned depending upon the value of `-banscore`. | ||||
*/ | */ | ||||
void Misbehaving(NodeId pnode, int howmuch, const std::string &reason) | void Misbehaving(NodeId pnode, int howmuch, const std::string &reason) { | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | AssertLockHeld(cs_main); | ||||
if (howmuch == 0) { | if (howmuch == 0) { | ||||
return; | return; | ||||
} | } | ||||
CNodeState *state = State(pnode); | CNodeState *state = State(pnode); | ||||
if (state == nullptr) { | if (state == nullptr) { | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,698 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::AVARESPONSE && !fImporting && !fReindex && | ||||
})) { | })) { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
Misbehaving(pfrom, 100, "invalid-ava-response-signature"); | Misbehaving(pfrom, 100, "invalid-ava-response-signature"); | ||||
return true; | return true; | ||||
} | } | ||||
std::vector<avalanche::BlockUpdate> updates; | std::vector<avalanche::BlockUpdate> updates; | ||||
if (!g_avalanche->registerVotes(pfrom.GetId(), response, updates)) { | if (!g_avalanche->registerVotes(pfrom.GetId(), response, updates)) { | ||||
LOCK(cs_main); | |||||
Misbehaving(pfrom, 100, "invalid-ava-response-content"); | |||||
return true; | return true; | ||||
} | } | ||||
if (updates.size()) { | if (updates.size()) { | ||||
for (avalanche::BlockUpdate &u : updates) { | for (avalanche::BlockUpdate &u : updates) { | ||||
CBlockIndex *pindex = u.getBlockIndex(); | CBlockIndex *pindex = u.getBlockIndex(); | ||||
switch (u.getStatus()) { | switch (u.getStatus()) { | ||||
case avalanche::BlockUpdate::Status::Invalid: | case avalanche::BlockUpdate::Status::Invalid: | ||||
▲ Show 20 Lines • Show All 1,397 Lines • Show Last 20 Lines |