There is a bug in mnw fix, so... fix the fix (should be && not ||) (#837)

Also make `nMinBlocksToStore` and `nStorageCoeff` const
This commit is contained in:
UdjinM6 2016-05-30 16:11:09 +04:00 committed by Holger Schinzel
parent 4d55bc9666
commit fb1ffded70
2 changed files with 5 additions and 7 deletions

View File

@ -677,10 +677,10 @@ int CMasternodePayments::GetNewestBlock()
} }
bool CMasternodePayments::IsEnoughData(int nMnCount) { 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; 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; return true;
} }

View File

@ -199,8 +199,8 @@ public:
class CMasternodePayments class CMasternodePayments
{ {
private: private:
int nMinBlocksToStore; const int nMinBlocksToStore;
float nStorageCoeff; const float nStorageCoeff;
// Keep track of current block index // Keep track of current block index
const CBlockIndex *pCurrentBlockIndex; const CBlockIndex *pCurrentBlockIndex;
@ -210,9 +210,7 @@ public:
std::map<int, CMasternodeBlockPayees> mapMasternodeBlocks; std::map<int, CMasternodeBlockPayees> mapMasternodeBlocks;
std::map<uint256, int> mapMasternodesLastVote; //Hash(BEGIN(prevout.hash), END(prevout.n)), nBlockHeight std::map<uint256, int> mapMasternodesLastVote; //Hash(BEGIN(prevout.hash), END(prevout.n)), nBlockHeight
CMasternodePayments() { CMasternodePayments() : nMinBlocksToStore(4000), nStorageCoeff(1.25) {
nMinBlocksToStore = 4000;
nStorageCoeff = 1.25;
} }
void Clear() { void Clear() {