Merged #1176: Added log message to print block height when IsBlockValueValid returns false

This commit is contained in:
Tim Flynn 2016-12-01 08:58:17 -05:00 committed by Holger Schinzel
parent 6d9e414c6a
commit d88249b787

View File

@ -2773,11 +2773,13 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
// DASH : MODIFYED TO CHECK MASTERNODE PAYMENTS AND SUPERBLOCKS // DASH : MODIFYED TO CHECK MASTERNODE PAYMENTS AND SUPERBLOCKS
CAmount blockReward = nFees + GetBlockSubsidy(pindex->pprev->nBits, pindex->pprev->nHeight, chainparams.GetConsensus()); CAmount blockReward = nFees + GetBlockSubsidy(pindex->pprev->nBits, pindex->pprev->nHeight, chainparams.GetConsensus());
if (!IsBlockValueValid(block, pindex->nHeight, blockReward)) if (!IsBlockValueValid(block, pindex->nHeight, blockReward)) {
LogPrintf("ConnectBlock() -- IsBlockValueValid returned false, nHeight = %d\n", pindex->nHeight);
// TODO: handle error here more accurate - this could actually fail for different reasons // TODO: handle error here more accurate - this could actually fail for different reasons
return state.DoS(100, error("ConnectBlock(): coinbase pays too much (actual=%d vs limit=%d)", return state.DoS(100, error("ConnectBlock(): coinbase pays too much (actual=%d vs limit=%d)",
block.vtx[0].GetValueOut(), blockReward), block.vtx[0].GetValueOut(), blockReward),
REJECT_INVALID, "bad-cb-amount"); REJECT_INVALID, "bad-cb-amount");
}
if (!IsBlockPayeeValid(block.vtx[0], pindex->nHeight, blockReward)) { if (!IsBlockPayeeValid(block.vtx[0], pindex->nHeight, blockReward)) {
mapRejectedBlocks.insert(make_pair(block.GetHash(), GetTime())); mapRejectedBlocks.insert(make_pair(block.GetHash(), GetTime()));