From 98be01b2071e20b6ae924f912a58cdb05e0f2c3a Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Fri, 28 Nov 2014 11:08:33 -0300 Subject: [PATCH] fix conditional format --- lib/script.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/script.js b/lib/script.js index 5b875e6..554a801 100644 --- a/lib/script.js +++ b/lib/script.js @@ -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;