rename MULTISIG to P2MS
This commit is contained in:
parent
a6f2cc2924
commit
d232545ac8
2 changed files with 8 additions and 8 deletions
|
@ -9,7 +9,7 @@ const witnessScriptHash = require('./templates/witnessscripthash')
|
||||||
const witnessCommitment = require('./templates/witnesscommitment')
|
const witnessCommitment = require('./templates/witnesscommitment')
|
||||||
|
|
||||||
const types = {
|
const types = {
|
||||||
MULTISIG: 'multisig',
|
P2MS: 'multisig',
|
||||||
NONSTANDARD: 'nonstandard',
|
NONSTANDARD: 'nonstandard',
|
||||||
NULLDATA: 'nulldata',
|
NULLDATA: 'nulldata',
|
||||||
P2PK: 'pubkey',
|
P2PK: 'pubkey',
|
||||||
|
@ -30,7 +30,7 @@ function classifyOutput (script) {
|
||||||
const chunks = decompile(script)
|
const chunks = decompile(script)
|
||||||
if (!chunks) throw new TypeError('Invalid 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 (pubKey.output.check(chunks)) return types.P2PK
|
||||||
if (witnessCommitment.output.check(chunks)) return types.WITNESS_COMMITMENT
|
if (witnessCommitment.output.check(chunks)) return types.WITNESS_COMMITMENT
|
||||||
if (nullData.output.check(chunks)) return types.NULLDATA
|
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 (pubKeyHash.input.check(chunks)) return types.P2PKH
|
||||||
if (scriptHash.input.check(chunks, allowIncomplete)) return types.P2SH
|
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
|
if (pubKey.input.check(chunks)) return types.P2PK
|
||||||
|
|
||||||
return types.NONSTANDARD
|
return types.NONSTANDARD
|
||||||
|
|
|
@ -56,14 +56,14 @@ function expandInput (scriptSig, witnessStack, type, scriptPubKey) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case SCRIPT_TYPES.MULTISIG: {
|
case SCRIPT_TYPES.P2MS: {
|
||||||
const { pubkeys, signatures } = payments.p2ms({
|
const { pubkeys, signatures } = payments.p2ms({
|
||||||
input: scriptSig,
|
input: scriptSig,
|
||||||
output: scriptPubKey
|
output: scriptPubKey
|
||||||
}, { allowIncomplete: true })
|
}, { allowIncomplete: true })
|
||||||
|
|
||||||
return {
|
return {
|
||||||
prevOutType: SCRIPT_TYPES.MULTISIG,
|
prevOutType: SCRIPT_TYPES.P2MS,
|
||||||
pubkeys: pubkeys,
|
pubkeys: pubkeys,
|
||||||
signatures: signatures
|
signatures: signatures
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ function expandInput (scriptSig, witnessStack, type, scriptPubKey) {
|
||||||
|
|
||||||
// could be done in expandInput, but requires the original Transaction for hashForSignature
|
// could be done in expandInput, but requires the original Transaction for hashForSignature
|
||||||
function fixMultisigOrder (input, transaction, vin) {
|
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
|
if (input.pubkeys.length === input.signatures.length) return
|
||||||
|
|
||||||
const unmatched = input.signatures.concat()
|
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 })
|
const p2ms = payments.p2ms({ output: script })
|
||||||
return {
|
return {
|
||||||
type,
|
type,
|
||||||
|
@ -392,7 +392,7 @@ function build (type, input, allowIncomplete) {
|
||||||
|
|
||||||
return payments.p2pk({ signature: signatures[0] })
|
return payments.p2pk({ signature: signatures[0] })
|
||||||
}
|
}
|
||||||
case SCRIPT_TYPES.MULTISIG: {
|
case SCRIPT_TYPES.P2MS: {
|
||||||
if (allowIncomplete) {
|
if (allowIncomplete) {
|
||||||
signatures = signatures.map(x => x || ops.OP_0)
|
signatures = signatures.map(x => x || ops.OP_0)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue