minor optimization.

This commit is contained in:
Christopher Jeffrey 2016-06-12 12:08:34 -07:00
parent 408102949c
commit 7e5b6a2ff7
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 2 additions and 3 deletions

View File

@ -849,8 +849,7 @@ Chain.prototype._checkInputs = function _checkInputs(block, prev, state, callbac
utils.forEachSerial(block.txs, function(tx, next) { utils.forEachSerial(block.txs, function(tx, next) {
// Ensure tx is not double spending an output. // Ensure tx is not double spending an output.
if (!tx.isCoinbase()) { if (!tx.isCoinbase()) {
view.fill(tx); if (!view.fillCoins(tx)) {
if (!tx.hasCoins()) {
assert(!historical, 'BUG: Spent inputs in historical data!'); assert(!historical, 'BUG: Spent inputs in historical data!');
return next(new VerifyError(block, return next(new VerifyError(block,
'invalid', 'invalid',

View File

@ -102,7 +102,7 @@ CoinView.prototype.spend = function spend(hash, index) {
* @returns {Boolean} True if all inputs were filled. * @returns {Boolean} True if all inputs were filled.
*/ */
CoinView.prototype.fill = function fill(tx) { CoinView.prototype.fillCoins = function fillCoins(tx) {
var res = true; var res = true;
var i, input, prevout; var i, input, prevout;