script: minor.

This commit is contained in:
Christopher Jeffrey 2017-07-03 02:34:56 -07:00
parent ba94eb106d
commit fdc9bca468
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -1867,6 +1867,7 @@ Script.prototype.isPubkey = function isPubkey(minimal) {
}
return this.code.length === 2
&& this.code[0].data
&& common.isKey(this.code[0].data)
&& this.code[1].value === opcodes.OP_CHECKSIG;
};
@ -1929,10 +1930,8 @@ Script.prototype.isMultisig = function isMultisig(minimal) {
if (!common.isKey(op.data))
return false;
if (minimal) {
if (!op.isMinimal())
return false;
}
if (minimal && !op.isMinimal())
return false;
}
return true;
@ -2182,7 +2181,9 @@ Script.prototype.isPubkeyInput = function isPubkeyInput() {
if (this.raw[0] > opcodes.OP_PUSHDATA4)
return false;
return this.code.length === 1 && common.isSignature(this.code[0].data);
return this.code.length === 1
&& this.code[1].data
&& common.isSignature(this.code[0].data);
};
/**
@ -2202,7 +2203,9 @@ Script.prototype.isPubkeyhashInput = function isPubkeyhashInput() {
return false;
return this.code.length === 2
&& this.code[0].data
&& common.isSignature(this.code[0].data)
&& this.code[1].data
&& common.isKey(this.code[1].data);
};
@ -2231,7 +2234,12 @@ Script.prototype.isMultisigInput = function isMultisigInput() {
return false;
for (let i = 1; i < this.code.length; i++) {
if (!common.isSignature(this.code[i].data))
let op = this.code[i];
if (!op.data)
return false;
if (!common.isSignature(op.data))
return false;
}