simplify CMasternodePayments::IsEnoughData (always using GetStorageLimit) (#1025)

* simplify CMasternodePayments::IsEnoughData (always using GetStorageLimit)
This commit is contained in:
UdjinM6 2016-09-21 19:32:42 +04:00 committed by GitHub
parent ec239ffa36
commit d6637c2e8e
3 changed files with 7 additions and 12 deletions

View File

@ -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()

View File

@ -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);

View File

@ -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;