def get_multisig(node):
    'Generate a fresh 2-of-3 multisig on node\n\n    Returns a named tuple of privkeys, pubkeys and all address and scripts.'
    addrs = []
    pubkeys = []
    for _ in range(3):
        addr = node.getaddressinfo(node.getnewaddress())
        addrs.append(addr['address'])
        pubkeys.append(addr['pubkey'])
    script_code = CScript((([OP_2] + [hex_str_to_bytes(pubkey) for pubkey in pubkeys]) + [OP_3, OP_CHECKMULTISIG]))
    witness_script = script_to_p2wsh_script(script_code)
    return Multisig(privkeys=[node.dumpprivkey(addr) for addr in addrs], pubkeys=pubkeys, p2sh_script=script_to_p2sh_script(script_code).hex(), p2sh_addr=script_to_p2sh(script_code), redeem_script=script_code.hex(), p2wsh_script=witness_script.hex(), p2wsh_addr=script_to_p2wsh(script_code), p2sh_p2wsh_script=script_to_p2sh_script(witness_script).hex(), p2sh_p2wsh_addr=script_to_p2sh_p2wsh(script_code))
Generate a fresh 2-of-3 multisig on node

Returns a named tuple of privkeys, pubkeys and all address and scripts.
def get_multisig(node):
    'Generate a fresh 2-of-3 multisig on node\n\n    Returns a named tuple of privkeys, pubkeys and all address and scripts.'
    addrs = []
    pubkeys = []
    for _ in range(3):
        addr = node.getaddressinfo(node.getnewaddress())
        addrs.append(addr['address'])
        pubkeys.append(addr['pubkey'])
    script_code = CScript((([OP_2] + [hex_str_to_bytes(pubkey) for pubkey in pubkeys]) + [OP_3, OP_CHECKMULTISIG]))
    witness_script = script_to_p2wsh_script(script_code)
    return Multisig(privkeys=[node.dumpprivkey(addr) for addr in addrs], pubkeys=pubkeys, p2sh_script=script_to_p2sh_script(script_code).hex(), p2sh_addr=script_to_p2sh(script_code), redeem_script=script_code.hex(), p2wsh_script=witness_script.hex(), p2wsh_addr=script_to_p2wsh(script_code), p2sh_p2wsh_script=script_to_p2sh_script(witness_script).hex(), p2sh_p2wsh_addr=script_to_p2sh_p2wsh(script_code))