Page MenuHomePhabricator

D10774.id31666.diff
No OneTemporary

D10774.id31666.diff

diff --git a/src/net_processing.cpp b/src/net_processing.cpp
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -4507,8 +4507,9 @@
// registerProof should not be called while cs_proofrequest because it
// holds cs_main and that creates a potential deadlock during shutdown
+ avalanche::ProofRegistrationState state;
if (g_avalanche->withPeerManager([&](avalanche::PeerManager &pm) {
- return pm.registerProof(proof);
+ return pm.registerProof(proof, state);
})) {
WITH_LOCK(cs_proofrequest, m_proofrequest.ForgetInvId(proofid));
RelayProof(proofid, m_connman);
@@ -4517,17 +4518,13 @@
LogPrint(BCLog::NET, "New avalanche proof: peer=%d, proofid %s\n",
nodeid, proofid.ToString());
- } else {
- // If the proof couldn't be added, it can be either orphan or
- // invalid. In the latter case we should increase the ban score.
- // TODO improve the ban reason by printing the validation state
- if (!g_avalanche->withPeerManager([&](avalanche::PeerManager &pm) {
- return pm.isOrphan(proofid);
- })) {
- WITH_LOCK(cs_rejectedProofs, rejectedProofs->insert(proofid));
- Misbehaving(nodeid, 100, "invalid-avaproof");
- }
}
+
+ if (state.GetResult() == avalanche::ProofRegistrationResult::INVALID) {
+ WITH_LOCK(cs_rejectedProofs, rejectedProofs->insert(proofid));
+ Misbehaving(nodeid, 100, state.GetRejectReason());
+ }
+
return;
}

File Metadata

Mime Type
text/plain
Expires
Mon, May 12, 01:41 (21 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5777041
Default Alt Text
D10774.id31666.diff (1 KB)

Event Timeline