Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/processor.cpp
Show First 20 Lines • Show All 667 Lines • ▼ Show 20 Lines | void Processor::avaproofsSent(NodeId nodeid) { | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* Returns a bool indicating whether we have a usable Avalanche quorum enabling | * Returns a bool indicating whether we have a usable Avalanche quorum enabling | ||||
* us to take decisions based on polls. | * us to take decisions based on polls. | ||||
*/ | */ | ||||
bool Processor::isQuorumEstablished() { | bool Processor::isQuorumEstablished() { | ||||
{ | |||||
LOCK(cs_peerManager); | |||||
if (peerManager->getNodeCount() < 8) { | |||||
// There is no point polling if we know the vote cannot converge | |||||
return false; | |||||
} | |||||
} | |||||
/* | |||||
* The following parameters can naturally go temporarly below the threshold | |||||
* under normal circumstances, like during a proof replacement with a lower | |||||
* stake amount, or the discovery of a new proofs for which we don't have a | |||||
* node yet. | |||||
* In order to prevent our node from starting and stopping the polls | |||||
* spuriously on such event, the quorum establishement is latched. The only | |||||
* parameters that should not latched is the minimum node count, as this | |||||
* would cause the poll to be inconclusive anyway and should not happen | |||||
* under normal circumstances. | |||||
*/ | |||||
if (quorumIsEstablished) { | if (quorumIsEstablished) { | ||||
return true; | return true; | ||||
} | } | ||||
// Don't do Avalanche while node is IBD'ing | // Don't do Avalanche while node is IBD'ing | ||||
if (chainman.ActiveChainstate().IsInitialBlockDownload()) { | if (chainman.ActiveChainstate().IsInitialBlockDownload()) { | ||||
return false; | return false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 272 Lines • Show Last 20 Lines |