From fb1ffded70d9450a7be7aa5fca48aaebd3fd36e9 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Mon, 30 May 2016 16:11:09 +0400 Subject: [PATCH] There is a bug in mnw fix, so... fix the fix (should be `&&` not `||`) (#837) Also make `nMinBlocksToStore` and `nStorageCoeff` const --- src/masternode-payments.cpp | 4 ++-- src/masternode-payments.h | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/masternode-payments.cpp b/src/masternode-payments.cpp index c7d51e63a..515cc50d1 100644 --- a/src/masternode-payments.cpp +++ b/src/masternode-payments.cpp @@ -677,10 +677,10 @@ int CMasternodePayments::GetNewestBlock() } bool CMasternodePayments::IsEnoughData(int nMnCount) { - if(GetBlockCount() > nMnCount * nStorageCoeff || GetBlockCount() > nMinBlocksToStore) + if(GetBlockCount() > nMnCount * nStorageCoeff && GetBlockCount() > nMinBlocksToStore) { float nAverageVotes = (MNPAYMENTS_SIGNATURES_TOTAL + MNPAYMENTS_SIGNATURES_REQUIRED) / 2; - if(GetVoteCount() > nMnCount * nStorageCoeff * nAverageVotes || GetVoteCount() > nMinBlocksToStore * nAverageVotes) + if(GetVoteCount() > nMnCount * nStorageCoeff * nAverageVotes && GetVoteCount() > nMinBlocksToStore * nAverageVotes) { return true; } diff --git a/src/masternode-payments.h b/src/masternode-payments.h index 400f14e2f..8d3b4a4f0 100644 --- a/src/masternode-payments.h +++ b/src/masternode-payments.h @@ -199,8 +199,8 @@ public: class CMasternodePayments { private: - int nMinBlocksToStore; - float nStorageCoeff; + const int nMinBlocksToStore; + const float nStorageCoeff; // Keep track of current block index const CBlockIndex *pCurrentBlockIndex; @@ -210,9 +210,7 @@ public: std::map mapMasternodeBlocks; std::map mapMasternodesLastVote; //Hash(BEGIN(prevout.hash), END(prevout.n)), nBlockHeight - CMasternodePayments() { - nMinBlocksToStore = 4000; - nStorageCoeff = 1.25; + CMasternodePayments() : nMinBlocksToStore(4000), nStorageCoeff(1.25) { } void Clear() {