func (w *Wallet) MakeMultiSigScript(addrs []btcutil.Address, nRequired int) ([]byte, error) {
	pubKeys := make([]*btcutil.AddressPubKey, len(addrs))
	var dbtx walletdb.ReadTx
	var addrmgrNs walletdb.ReadBucket
	defer func() {
		if dbtx != nil {
			_ = dbtx.Rollback()
		}
	}()
	for i, addr := range addrs {
		switch addr := addr.(type) {
		default:
			return nil, errors.New("cannot make multisig script for " +
				"a non-secp256k1 public key or P2PKH address")
		case *btcutil.AddressPubKey:
			pubKeys[i] = addr
		case *btcutil.AddressPubKeyHash:
			if dbtx == nil {
				var err error
				dbtx, err = w.db.BeginReadTx()
				if err != nil {
					return nil, err
				}
				addrmgrNs = dbtx.ReadBucket(waddrmgrNamespaceKey)
			}
			addrInfo, err := w.Manager.Address(addrmgrNs, addr)
			if err != nil {
				return nil, err
			}
			serializedPubKey := addrInfo.(waddrmgr.ManagedPubKeyAddress).
				PubKey().SerializeCompressed()
			pubKeyAddr, err := btcutil.NewAddressPubKey(
				serializedPubKey, w.chainParams)
			if err != nil {
				return nil, err
			}
			pubKeys[i] = pubKeyAddr
		}
	}
	return txscript.MultiSigScript(pubKeys, nRequired)
}
MakeMultiSigScript creates a multi-signature script that can be redeemed with
nRequired signatures of the passed keys and addresses.  If the address is a
P2PKH address, the associated pubkey is looked up by the wallet if possible,
otherwise an error is returned for a missing pubkey.

This function only works with pubkeys and P2PKH addresses derived from them.
package wallet
import (
	"errors"
	"github.com/btcsuite/btcd/txscript"
	"github.com/btcsuite/btcutil"
	"github.com/btcsuite/btcwallet/waddrmgr"
	"github.com/btcsuite/btcwallet/walletdb"
)