more fixes. cleanup debugging.

This commit is contained in:
Christopher Jeffrey 2016-02-28 06:05:59 -08:00
parent 0e3aa32677
commit 8a8b664061
4 changed files with 8 additions and 20 deletions

View File

@ -660,12 +660,6 @@ Chain.prototype._checkInputs = function _checkInputs(block, prev, flags, callbac
var i, j, input, hash; var i, j, input, hash;
var sigops = 0; var sigops = 0;
// utils.print(height);
// utils.print(block.commitmentHash ? utils.revHex(block.commitmentHash) : null);
// utils.print(utils.revHex(block.getCommitmentHash() || '00'));
// utils.print(block.txs[0]);
// utils.print(block.txs[1]);
if (err) if (err)
return callback(err); return callback(err);
@ -711,9 +705,6 @@ Chain.prototype._checkInputs = function _checkInputs(block, prev, flags, callbac
throw new Error('BUG: Bad inputs in historical data!'); throw new Error('BUG: Bad inputs in historical data!');
return callback(null, false); return callback(null, false);
} }
if (input.output.getType() === 'scripthash')
utils.debug(tx);
} }
if (!scriptCheck) if (!scriptCheck)

View File

@ -294,7 +294,7 @@ exports.flags = {
VERIFY_CLEANSTACK: (1 << 8), VERIFY_CLEANSTACK: (1 << 8),
VERIFY_CHECKLOCKTIMEVERIFY: (1 << 9), VERIFY_CHECKLOCKTIMEVERIFY: (1 << 9),
VERIFY_WITNESS: (1 << 10), VERIFY_WITNESS: (1 << 10),
VERIFY_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM: (1 << 9) VERIFY_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM: (1 << 11)
}; };
// Block validation // Block validation

View File

@ -462,13 +462,8 @@ script.verifyProgram = function verifyProgram(witness, output, tx, i, flags) {
return false; return false;
} }
utils.debug(bcoin.script.format(stack));
utils.debug(bcoin.script.format(redeem));
res = script.execute(redeem, stack, tx, i, flags, 1); res = script.execute(redeem, stack, tx, i, flags, 1);
utils.debug(bcoin.script.format(stack));
// Verify the script did not fail as well as the stack values // Verify the script did not fail as well as the stack values
if (!res || stack.length === 0 || !script.bool(stack.pop())) if (!res || stack.length === 0 || !script.bool(stack.pop()))
return false; return false;

View File

@ -131,12 +131,14 @@ TX.prototype.witnessHash = function witnessHash(enc) {
}; };
TX.prototype.hasWitness = function hasWitness() { TX.prototype.hasWitness = function hasWitness() {
if (this.inputs.length === 0) var i;
return false;
return this.inputs.every(function(input) { for (i = 0; i < this.inputs.length; i++) {
return input.witness.length > 0; if (this.inputs[i].witness.length > 0)
}); return true;
}
return false;
}; };
TX.prototype.render = function render() { TX.prototype.render = function render() {