Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.cpp
Show First 20 Lines • Show All 277 Lines • ▼ Show 20 Lines | |||||
bool PeerManager::createPeer(const ProofRef &proof) { | bool PeerManager::createPeer(const ProofRef &proof) { | ||||
assert(proof); | assert(proof); | ||||
switch (validProofPool.addProofIfNoConflict(proof)) { | switch (validProofPool.addProofIfNoConflict(proof)) { | ||||
case ProofPool::AddProofStatus::REJECTED: | case ProofPool::AddProofStatus::REJECTED: | ||||
// The proof has conflicts, move it to the conflicting proof pool so | // The proof has conflicts, move it to the conflicting proof pool so | ||||
// it can be pulled back if the conflicting ones are invalidated. | // it can be pulled back if the conflicting ones are invalidated. | ||||
conflictingProofPool.addProofIfNoConflict(proof); | conflictingProofPool.addProofIfPreferred(proof); | ||||
return false; | return false; | ||||
case ProofPool::AddProofStatus::DUPLICATED: | case ProofPool::AddProofStatus::DUPLICATED: | ||||
// If the proof was already in the pool, don't duplicate the peer. | // If the proof was already in the pool, don't duplicate the peer. | ||||
return false; | return false; | ||||
case ProofPool::AddProofStatus::SUCCEED: | case ProofPool::AddProofStatus::SUCCEED: | ||||
break; | break; | ||||
// No default case, so the compiler can warn about missing cases | // No default case, so the compiler can warn about missing cases | ||||
▲ Show 20 Lines • Show All 276 Lines • Show Last 20 Lines |