|
|
@ -171,7 +171,10 @@ Script.prototype.toString = function() { |
|
|
|
Script.prototype.isOpReturn = function() { |
|
|
|
if (this.chunks[0] === Opcode('OP_RETURN').toNumber() && |
|
|
|
(this.chunks.length === 1 || |
|
|
|
(this.chunks.length === 2 && this.chunks[1].buf && this.chunks[1].buf.length <= 40 && this.chunks[1].length === this.chunks.len))) { |
|
|
|
(this.chunks.length === 2 && |
|
|
|
this.chunks[1].buf && |
|
|
|
this.chunks[1].buf.length <= 40 && |
|
|
|
this.chunks[1].length === this.chunks.len))) { |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
return false; |
|
|
@ -179,7 +182,11 @@ Script.prototype.isOpReturn = function() { |
|
|
|
}; |
|
|
|
|
|
|
|
Script.prototype.isPublicKeyHashOut = function() { |
|
|
|
if (this.chunks[0] === Opcode('OP_DUP').toNumber() && this.chunks[1] === Opcode('OP_HASH160').toNumber() && this.chunks[2].buf && this.chunks[3] === Opcode('OP_EQUALVERIFY').toNumber() && this.chunks[4] === Opcode('OP_CHECKSIG').toNumber()) { |
|
|
|
if (this.chunks[0] === Opcode('OP_DUP').toNumber() && |
|
|
|
this.chunks[1] === Opcode('OP_HASH160').toNumber() && |
|
|
|
this.chunks[2].buf && |
|
|
|
this.chunks[3] === Opcode('OP_EQUALVERIFY').toNumber() && |
|
|
|
this.chunks[4] === Opcode('OP_CHECKSIG').toNumber()) { |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
return false; |
|
|
@ -187,7 +194,9 @@ Script.prototype.isPublicKeyHashOut = function() { |
|
|
|
}; |
|
|
|
|
|
|
|
Script.prototype.isPublicKeyHashIn = function() { |
|
|
|
if (this.chunks.length === 2 && this.chunks[0].buf && this.chunks[1].buf) { |
|
|
|
if (this.chunks.length === 2 && |
|
|
|
this.chunks[0].buf && |
|
|
|
this.chunks[1].buf) { |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
return false; |
|
|
@ -195,7 +204,11 @@ Script.prototype.isPublicKeyHashIn = function() { |
|
|
|
}; |
|
|
|
|
|
|
|
Script.prototype.isScriptHashOut = function() { |
|
|
|
if (this.chunks.length === 3 && this.chunks[0] === Opcode('OP_HASH160').toNumber() && this.chunks[1].buf && this.chunks[1].buf.length === 20 && this.chunks[2] === Opcode('OP_EQUAL').toNumber()) { |
|
|
|
if (this.chunks.length === 3 && |
|
|
|
this.chunks[0] === Opcode('OP_HASH160').toNumber() && |
|
|
|
this.chunks[1].buf && |
|
|
|
this.chunks[1].buf.length === 20 && |
|
|
|
this.chunks[2] === Opcode('OP_EQUAL').toNumber()) { |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
return false; |
|
|
|