mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +01:00
simplify CMasternodePayments::IsEnoughData (always using GetStorageLimit) (#1025)
* simplify CMasternodePayments::IsEnoughData (always using GetStorageLimit)
This commit is contained in:
parent
ec239ffa36
commit
d6637c2e8e
@ -848,16 +848,11 @@ std::string CMasternodePayments::ToString() const
|
||||
return info.str();
|
||||
}
|
||||
|
||||
bool CMasternodePayments::IsEnoughData(int nMnCount) {
|
||||
if(GetBlockCount() > nMnCount * nStorageCoeff && GetBlockCount() > nMinBlocksToStore)
|
||||
{
|
||||
bool CMasternodePayments::IsEnoughData()
|
||||
{
|
||||
float nAverageVotes = (MNPAYMENTS_SIGNATURES_TOTAL + MNPAYMENTS_SIGNATURES_REQUIRED) / 2;
|
||||
if(GetVoteCount() > nMnCount * nStorageCoeff * nAverageVotes && GetVoteCount() > nMinBlocksToStore * nAverageVotes)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
int nStorageLimit = GetStorageLimit();
|
||||
return GetBlockCount() > nStorageLimit && GetVoteCount() > nStorageLimit * nAverageVotes;
|
||||
}
|
||||
|
||||
int CMasternodePayments::GetStorageLimit()
|
||||
|
@ -205,7 +205,7 @@ public:
|
||||
int GetBlockCount() { return mapMasternodeBlocks.size(); }
|
||||
int GetVoteCount() { return mapMasternodePaymentVotes.size(); }
|
||||
|
||||
bool IsEnoughData(int nMnCount);
|
||||
bool IsEnoughData();
|
||||
int GetStorageLimit();
|
||||
|
||||
void UpdatedBlockTip(const CBlockIndex *pindex);
|
||||
|
@ -296,7 +296,7 @@ void CMasternodeSync::ProcessTick()
|
||||
// check for data
|
||||
// if mnpayments already has enough blocks and votes, switch to the next asset
|
||||
// try to fetch data from at least two peers though
|
||||
if(nRequestedMasternodeAttempt > 1 && mnpayments.IsEnoughData(mnpayments.GetStorageLimit())) {
|
||||
if(nRequestedMasternodeAttempt > 1 && mnpayments.IsEnoughData()) {
|
||||
LogPrintf("CMasternodeSync::Process -- nTick %d nRequestedMasternodeAssets %d -- found enough data\n", nTick, nRequestedMasternodeAssets);
|
||||
SwitchToNextAsset();
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user