Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 4,452 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::AVAPROOF) { | ||||
WITH_LOCK(cs_proofrequest, m_proofrequest.ForgetInvId(proofid)); | WITH_LOCK(cs_proofrequest, m_proofrequest.ForgetInvId(proofid)); | ||||
RelayProof(proofid, m_connman); | RelayProof(proofid, m_connman); | ||||
pfrom.nLastProofTime = GetTime(); | pfrom.nLastProofTime = GetTime(); | ||||
LogPrint(BCLog::NET, "New avalanche proof: peer=%d, proofid %s\n", | LogPrint(BCLog::NET, "New avalanche proof: peer=%d, proofid %s\n", | ||||
nodeid, proofid.ToString()); | nodeid, proofid.ToString()); | ||||
} else { | } else { | ||||
// If the proof couldn't be added, it can be either orphan or | // If the proof couldn't be added, it can be orphan, conflicting or | ||||
// invalid. In the latter case we should increase the ban score. | // invalid. In the latter case we should increase the ban score. | ||||
// TODO improve the ban reason by printing the validation state | // TODO improve the ban reason by printing the validation state | ||||
if (!g_avalanche->withPeerManager([&](avalanche::PeerManager &pm) { | if (!g_avalanche->withPeerManager([&](avalanche::PeerManager &pm) { | ||||
return pm.getOrphan(proofid); | return pm.getOrphan(proofid) || | ||||
pm.isConflictingProof(proofid); | |||||
})) { | })) { | ||||
WITH_LOCK(cs_rejectedProofs, rejectedProofs->insert(proofid)); | WITH_LOCK(cs_rejectedProofs, rejectedProofs->insert(proofid)); | ||||
Misbehaving(nodeid, 100, "invalid-avaproof"); | Misbehaving(nodeid, 100, "invalid-avaproof"); | ||||
} | } | ||||
} | } | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,486 Lines • Show Last 20 Lines |