From d232545ac8728f5417de25ff4b06570d8f0775e3 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Mon, 3 Sep 2018 14:06:30 +1000 Subject: [PATCH] rename MULTISIG to P2MS --- src/classify.js | 6 +++--- src/transaction_builder.js | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/classify.js b/src/classify.js index 0b98fa6..8350e07 100644 --- a/src/classify.js +++ b/src/classify.js @@ -9,7 +9,7 @@ const witnessScriptHash = require('./templates/witnessscripthash') const witnessCommitment = require('./templates/witnesscommitment') const types = { - MULTISIG: 'multisig', + P2MS: 'multisig', NONSTANDARD: 'nonstandard', NULLDATA: 'nulldata', P2PK: 'pubkey', @@ -30,7 +30,7 @@ function classifyOutput (script) { const chunks = decompile(script) if (!chunks) throw new TypeError('Invalid script') - if (multisig.output.check(chunks)) return types.MULTISIG + if (multisig.output.check(chunks)) return types.P2MS if (pubKey.output.check(chunks)) return types.P2PK if (witnessCommitment.output.check(chunks)) return types.WITNESS_COMMITMENT if (nullData.output.check(chunks)) return types.NULLDATA @@ -45,7 +45,7 @@ function classifyInput (script, allowIncomplete) { if (pubKeyHash.input.check(chunks)) return types.P2PKH if (scriptHash.input.check(chunks, allowIncomplete)) return types.P2SH - if (multisig.input.check(chunks, allowIncomplete)) return types.MULTISIG + if (multisig.input.check(chunks, allowIncomplete)) return types.P2MS if (pubKey.input.check(chunks)) return types.P2PK return types.NONSTANDARD diff --git a/src/transaction_builder.js b/src/transaction_builder.js index 8706841..a97df14 100644 --- a/src/transaction_builder.js +++ b/src/transaction_builder.js @@ -56,14 +56,14 @@ function expandInput (scriptSig, witnessStack, type, scriptPubKey) { } } - case SCRIPT_TYPES.MULTISIG: { + case SCRIPT_TYPES.P2MS: { const { pubkeys, signatures } = payments.p2ms({ input: scriptSig, output: scriptPubKey }, { allowIncomplete: true }) return { - prevOutType: SCRIPT_TYPES.MULTISIG, + prevOutType: SCRIPT_TYPES.P2MS, pubkeys: pubkeys, signatures: signatures } @@ -126,7 +126,7 @@ function expandInput (scriptSig, witnessStack, type, scriptPubKey) { // could be done in expandInput, but requires the original Transaction for hashForSignature function fixMultisigOrder (input, transaction, vin) { - if (input.redeemScriptType !== SCRIPT_TYPES.MULTISIG || !input.redeemScript) return + if (input.redeemScriptType !== SCRIPT_TYPES.P2MS || !input.redeemScript) return if (input.pubkeys.length === input.signatures.length) return const unmatched = input.signatures.concat() @@ -202,7 +202,7 @@ function expandOutput (script, ourPubKey) { } } - case SCRIPT_TYPES.MULTISIG: { + case SCRIPT_TYPES.P2MS: { const p2ms = payments.p2ms({ output: script }) return { type, @@ -392,7 +392,7 @@ function build (type, input, allowIncomplete) { return payments.p2pk({ signature: signatures[0] }) } - case SCRIPT_TYPES.MULTISIG: { + case SCRIPT_TYPES.P2MS: { if (allowIncomplete) { signatures = signatures.map(x => x || ops.OP_0) } else {