fix checkmultisig for nonstandard scripts.

This commit is contained in:
Christopher Jeffrey 2016-02-18 22:53:13 -08:00
parent 8b17c09116
commit 29576c7bcc

View File

@ -918,7 +918,7 @@ script.execute = function execute(data, stack, tx, index, flags, recurse) {
}
case 'checkmultisigverify':
case 'checkmultisig': {
if (!tx || stack.length < 3)
if (!tx || stack.length < 4)
return false;
n = script.num(stack.pop(), true);
@ -944,7 +944,7 @@ script.execute = function execute(data, stack, tx, index, flags, recurse) {
if (!(m >= 1 && m <= n))
return false;
if (stack.length < m + 1)
if (stack.length < m)
return false;
subscript = script.getSubscript(data, lastSep);
@ -973,12 +973,12 @@ script.execute = function execute(data, stack, tx, index, flags, recurse) {
succ++;
}
if (stack.length < 1)
return false;
val = stack.pop();
if (flags & constants.flags.VERIFY_NULLDUMMY) {
if (stack.length < 1)
return false;
val = stack.pop();
if (!script.isDummy(val))
return false;
}
@ -1009,8 +1009,10 @@ script.execute = function execute(data, stack, tx, index, flags, recurse) {
if (!Array.isArray(locktime))
return false;
if (locktime.length > 6)
if (locktime.length > 6) {
utils.debug('Warning: locktime is over 53 bits.');
return false;
}
locktime = script.num(locktime, true);
@ -1028,7 +1030,7 @@ script.execute = function execute(data, stack, tx, index, flags, recurse) {
if (locktime > tx.locktime)
return false;
if (!tx.inputs[index] || tx.inputs[index].sequence === 0xffffffff)
if (tx.inputs[index].sequence === 0xffffffff)
return false;
break;