script: minor.

This commit is contained in:
Christopher Jeffrey 2017-07-11 19:07:43 -07:00
parent ec475d6d1c
commit 50c75aeea8
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -2891,7 +2891,7 @@ Script.verify = function verify(input, witness, output, tx, i, value, flags) {
Script.verifyProgram = function verifyProgram(witness, output, flags, tx, i, value) {
let program = output.toProgram();
let stack = witness.toStack();
let j, witnessScript, redeem;
let witnessScript, redeem;
assert(program, 'verifyProgram called on non-witness-program.');
assert((flags & Script.flags.VERIFY_WITNESS) !== 0);
@ -2932,7 +2932,7 @@ Script.verifyProgram = function verifyProgram(witness, output, flags, tx, i, val
}
// Witnesses still have push limits.
for (j = 0; j < stack.length; j++) {
for (let j = 0; j < stack.length; j++) {
if (stack.get(j).length > consensus.MAX_SCRIPT_PUSH)
throw new ScriptError('PUSH_SIZE');
}
@ -2967,7 +2967,6 @@ Script.verifyMast = function verifyMast(program, stack, output, flags, tx, i, va
let version = 0;
let pathdata, depth, path, posdata, pos;
let metadata, subscripts, ops, script;
let j;
assert(program.version === 1);
assert((flags & Script.flags.VERIFY_MAST) !== 0);
@ -2989,7 +2988,7 @@ Script.verifyMast = function verifyMast(program, stack, output, flags, tx, i, va
if (metadata[metadata.length - 1] === 0x00)
throw new ScriptError('INVALID_MAST_STACK');
for (j = 1; j < metadata.length; j++)
for (let j = 1; j < metadata.length; j++)
version |= metadata[i] << 8 * (j - 1);
if (version < 0)
@ -3020,7 +3019,7 @@ Script.verifyMast = function verifyMast(program, stack, output, flags, tx, i, va
path = [];
for (j = 0; j < depth; j++)
for (let j = 0; j < depth; j++)
path.push(pathdata.slice(j * 32, j * 32 + 32));
posdata = stack.top(-3);
@ -3033,7 +3032,7 @@ Script.verifyMast = function verifyMast(program, stack, output, flags, tx, i, va
if (posdata[posdata.length - 1] === 0x00)
throw new ScriptError('INVALID_MAST_STACK');
for (j = 0; j < posdata.length; j++)
for (let j = 0; j < posdata.length; j++)
pos |= posdata[i] << 8 * j;
if (pos < 0)
@ -3047,7 +3046,7 @@ Script.verifyMast = function verifyMast(program, stack, output, flags, tx, i, va
scripts.writeBytes(output.raw);
for (j = 0; j < subscripts; j++) {
for (let j = 0; j < subscripts; j++) {
script = stack.top(-(4 + j));
if (version === 0) {
if ((scripts.written + script.length) > consensus.MAX_SCRIPT_SIZE)
@ -3069,7 +3068,7 @@ Script.verifyMast = function verifyMast(program, stack, output, flags, tx, i, va
if (version === 0) {
stack.length -= 3 + subscripts;
for (j = 0; j < stack.length; j++) {
for (let j = 0; j < stack.length; j++) {
if (stack.get(j).length > consensus.MAX_SCRIPT_PUSH)
throw new ScriptError('PUSH_SIZE');
}