diff --git a/src/avalanche/peermanager.cpp b/src/avalanche/peermanager.cpp --- a/src/avalanche/peermanager.cpp +++ b/src/avalanche/peermanager.cpp @@ -261,7 +261,18 @@ if (gArgs.GetBoolArg( "-enableavalancheproofreplacement", AVALANCHE_DEFAULT_PROOF_REPLACEMENT_ENABLED)) { - if (validProofPool.addProofIfPreferred(proof)) { + auto addProofStatus = + validProofPool.addProofIfPreferred(proof); + if (addProofStatus == ProofPool::AddProofStatus::SUCCEED || + addProofStatus == + ProofPool::AddProofStatus::DUPLICATED) { + // Note on DUPLICATED: this should never happen because + // it indicates a proof and others that conflict with it + // are both in the valid pool at the same time. But if + // this situation did arise, attempt to handle it + // gracefully, moving the conflicting proofs into the + // conflict pool. + // If we have overridden other proofs due to conflict, // remove the peers and attempt to move them to the // conflicting pool.