From 78faaddf4df3d6522e8eeb4917707e2f8a277799 Mon Sep 17 00:00:00 2001 From: Thomas Kerin Date: Thu, 10 Nov 2016 10:12:18 +0100 Subject: [PATCH] remove SIGNABLE_TYPES and P2SH_scripts --- src/templates/index.js | 8 +------- test/script.js | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/templates/index.js b/src/templates/index.js index 666075e..1994032 100644 --- a/src/templates/index.js +++ b/src/templates/index.js @@ -17,9 +17,6 @@ var types = { P2WSH: 'witnessscripthash' } -var SIGNABLE_SCRIPTS = [types.MULTISIG, types.P2PKH, types.P2PK] -var P2SH_SCRIPTS = SIGNABLE_SCRIPTS.concat([types.P2WPKH, types.P2WSH]) - function classifyOutput (script) { if (witnessPubKeyHash.output.check(script)) return types.P2WPKH if (witnessScriptHash.output.check(script)) return types.P2WSH @@ -102,7 +99,6 @@ function solveOutput (scriptCode) { type: outputType, script: scriptCode, solvedBy: solvedBy, - canSign: SIGNABLE_SCRIPTS.indexOf(outputType) !== -1, requiredSigs: requiredSigs } } @@ -119,7 +115,5 @@ module.exports = { scriptHash: scriptHash, witnessPubKeyHash: witnessPubKeyHash, witnessScriptHash: witnessScriptHash, - types: types, - SIGNABLE_SCRIPTS: SIGNABLE_SCRIPTS, - P2SH_SCRIPTS: P2SH_SCRIPTS + types: types } diff --git a/test/script.js b/test/script.js index 802a484..c72b533 100644 --- a/test/script.js +++ b/test/script.js @@ -119,7 +119,7 @@ describe('script', function () { it('solves ' + bscript.toASM(script) + ' as ' + f.type, function () { var solution = bscript.solveOutput(script) assert.equal(solution.type, f.type) - if ([bscript.types.P2SH].concat(bscript.P2SH_SCRIPTS).indexOf(f.type) === -1) { + if ([bscript.types.P2SH, bscript.types.P2WSH, bscript.types.P2WPKH, bscript.types.P2PKH, bscript.types.P2PK, bscript.types.MULTISIG].indexOf(f.type) === -1) { assert.equal(solution.solvedBy, null) } if (solution.canSign) {