rename MULTISIG to P2MS

This commit is contained in:
Daniel Cousens 2018-09-03 14:06:30 +10:00
parent a6f2cc2924
commit d232545ac8
2 changed files with 8 additions and 8 deletions

View file

@ -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

View file

@ -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 {