From b7febc1bd807c2fe25f99b509654b43d7294de15 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Mon, 13 Oct 2014 18:38:54 +1100 Subject: [PATCH] scripts: re-order classify functions --- src/scripts.js | 68 +++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/scripts.js b/src/scripts.js index fdec7b1..fafb91e 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -8,40 +8,6 @@ var curve = ecurve.getCurveByName('secp256k1') var ECSignature = require('./ecsignature') var Script = require('./script') -function classifyOutput(script) { - enforceType(Script, script) - - if (isPubKeyHashOutput.call(script)) { - return 'pubkeyhash' - } else if (isScriptHashOutput.call(script)) { - return 'scripthash' - } else if (isMultisigOutput.call(script)) { - return 'multisig' - } else if (isPubKeyOutput.call(script)) { - return 'pubkey' - } else if (isNulldataOutput.call(script)) { - return 'nulldata' - } else { - return 'nonstandard' - } -} - -function classifyInput(script) { - enforceType(Script, script) - - if (isPubKeyHashInput.call(script)) { - return 'pubkeyhash' - } else if (isScriptHashInput.call(script)) { - return 'scripthash' - } else if (isMultisigInput.call(script)) { - return 'multisig' - } else if (isPubKeyInput.call(script)) { - return 'pubkey' - } else { - return 'nonstandard' - } -} - function isCanonicalPubKey(buffer) { if (!Buffer.isBuffer(buffer)) return false @@ -150,6 +116,40 @@ function isNulldataOutput() { return this.chunks[0] === ops.OP_RETURN } +function classifyOutput(script) { + enforceType(Script, script) + + if (isPubKeyHashOutput.call(script)) { + return 'pubkeyhash' + } else if (isScriptHashOutput.call(script)) { + return 'scripthash' + } else if (isMultisigOutput.call(script)) { + return 'multisig' + } else if (isPubKeyOutput.call(script)) { + return 'pubkey' + } else if (isNulldataOutput.call(script)) { + return 'nulldata' + } else { + return 'nonstandard' + } +} + +function classifyInput(script) { + enforceType(Script, script) + + if (isPubKeyHashInput.call(script)) { + return 'pubkeyhash' + } else if (isScriptHashInput.call(script)) { + return 'scripthash' + } else if (isMultisigInput.call(script)) { + return 'multisig' + } else if (isPubKeyInput.call(script)) { + return 'pubkey' + } else { + return 'nonstandard' + } +} + // Standard Script Templates // {pubKey} OP_CHECKSIG function pubKeyOutput(pubKey) {