Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14362703
D10774.id31666.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D10774.id31666.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Mon, May 12, 01:41 (3 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5777041
Default Alt Text
D10774.id31666.diff (1 KB)
Attached To
D10774: [avalanche] Use the proof registration state in net processing
Event Timeline
Log In to Comment