Skip to content

Commit

Permalink
modified: src/masternodeman.cpp
Browse files Browse the repository at this point in the history
	modified:   src/validation.cpp
  • Loading branch information
exosiscrypto committed Nov 22, 2018
1 parent d80714e commit 9d53e6b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/masternodeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1456,10 +1456,10 @@ void CMasternodeMan::UpdateLastPaid(const CBlockIndex* pindex)

if(fLiteMode || !masternodeSync.IsWinnersListSynced() || mapMasternodes.empty()) return;

static bool IsFirstRun = true;

// Do full scan on first run or if we are not a masternode
// (MNs should update this info on every block, so limited scan should be enough for them)
int nMaxBlocksToScanBack = (IsFirstRun || !fMasterNode) ? mnpayments.GetStorageLimit() : LAST_PAID_SCAN_BLOCKS;
int nMaxBlocksToScanBack = 5;

// LogPrint("mnpayments", "CMasternodeMan::UpdateLastPaid -- nHeight=%d, nMaxBlocksToScanBack=%d, IsFirstRun=%s\n",
// nCachedBlockHeight, nMaxBlocksToScanBack, IsFirstRun ? "true" : "false");
Expand All @@ -1468,9 +1468,10 @@ void CMasternodeMan::UpdateLastPaid(const CBlockIndex* pindex)
mnpair.second.UpdateLastPaid(pindex, nMaxBlocksToScanBack);
}

IsFirstRun = false;

}


void CMasternodeMan::UpdateWatchdogVoteTime(const COutPoint& outpoint, uint64_t nVoteTime)
{
LOCK(cs);
Expand Down
6 changes: 4 additions & 2 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2095,6 +2095,7 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
CAmount masternodePayment = GetMasternodePayment(pindex->nHeight, blockReward);
if (pindex->nHeight >= 9255)
{

if (block.vtx[0]->GetValueOut() > blockReward + nFees + masternodePayment)
return state.DoS(100,
error("ConnectBlock(): coinbase pays too much (actual=%d vs limit=%d)",
Expand All @@ -2104,7 +2105,7 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl

if (block.vtx[0]->GetValueOut() > blockReward + nFees)
{

if (!IsBlockPayeeValid(block.vtx[0], pindex->nHeight, block.vtx[0]->GetValueOut(), pindex->GetBlockHeader())) {
mapRejectedBlocks.insert(make_pair(block.GetHash(), GetTime()));
return state.DoS(0, error("ConnectBlock(EXOSIS): couldn't find masternode or superblock payments"),
Expand All @@ -2123,7 +2124,8 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
}




mnodeman.UpdateLastPaid(pindex);



Expand Down

0 comments on commit 9d53e6b

Please sign in to comment.