add chain._checkReward.

This commit is contained in:
Christopher Jeffrey 2016-02-23 21:02:50 -08:00
parent badf7e4d83
commit c559f97c26

View File

@ -691,6 +691,21 @@ Chain.prototype._checkInputs = function _checkInputs(block, prev, flags, callbac
});
};
Chain.prototype._checkReward = function _checkReward(block) {
var claimed, actual;
claimed = block.txs[0].getOutputValue();
actual = bcoin.block.reward(block.height);
for (i = 1; i < block.txs.length; i++)
actual.iadd(block.txs[i].getFee());
if (claimed.cmp(actual) > 0)
return false;
return true;
};
Chain.prototype._fillBlock = function _fillBlock(block, callback) {
var self = this;