Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.cpp
Show First 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | bool PeerManager::registerProof(const ProofRef &proof) { | ||||
// Check the proof's validity. | // Check the proof's validity. | ||||
ProofValidationState state; | ProofValidationState state; | ||||
// Using WITH_LOCK directly inside the if statement will trigger a cppcheck | // Using WITH_LOCK directly inside the if statement will trigger a cppcheck | ||||
// false positive syntax error | // false positive syntax error | ||||
const bool valid = WITH_LOCK( | const bool valid = WITH_LOCK( | ||||
cs_main, return proof->verify(state, ::ChainstateActive().CoinsTip())); | cs_main, return proof->verify(state, ::ChainstateActive().CoinsTip())); | ||||
if (!valid) { | if (!valid) { | ||||
if (isOrphanState(state)) { | if (isOrphanState(state)) { | ||||
orphanProofPool.addProofIfNoConflict(proof); | orphanProofPool.addProofIfPreferred(proof); | ||||
} | } | ||||
// Reject invalid proof. | // Reject invalid proof. | ||||
return false; | return false; | ||||
} | } | ||||
return createPeer(proof); | return createPeer(proof); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 398 Lines • Show Last 20 Lines |