From 7f1da3bc0722cdeac2bf6e5c41f61dd80fdf6263 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Wed, 13 Mar 2019 01:10:59 -0500 Subject: [PATCH] txscript: Deprecate GetMultisigMandN. This deprecates the GetMultisigMandN function which should never have been added since the CalcMultiSigStats function already existed for this purpose. While here, redefine the function in terms of CalcMultiSigStats. --- txscript/standard.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/txscript/standard.go b/txscript/standard.go index d701b31b..06aa52a3 100644 --- a/txscript/standard.go +++ b/txscript/standard.go @@ -1096,18 +1096,16 @@ func PushedData(script []byte) ([][]byte, error) { // GetMultisigMandN returns the number of public keys and the number of // signatures required to redeem the multisignature script. +// +// DEPRECATED. Use CalcMultiSigStats instead. This will be removed in the next +// major version bump. func GetMultisigMandN(script []byte) (uint8, uint8, error) { - // No valid addresses or required signatures if the script doesn't - // parse. - pops, err := parseScript(script) + numPubKeys, requiredSigs, err := CalcMultiSigStats(script) if err != nil { return 0, 0, err } - requiredSigs := uint8(asSmallInt(pops[0].opcode)) - numPubKeys := uint8(asSmallInt(pops[len(pops)-2].opcode)) - - return requiredSigs, numPubKeys, nil + return uint8(requiredSigs), uint8(numPubKeys), nil } // ExtractPkScriptAddrs returns the type of script, addresses and required