MCPcopy Create free account
hub / github.com/ElementsProject/elements / get_multisig

Function get_multisig

test/functional/test_framework/wallet_util.py:101–121  ·  view source on GitHub ↗

Generate a fresh 2-of-3 multisig on node Returns a named tuple of privkeys, pubkeys and all address and scripts.

(node)

Source from the content-addressed store, hash-verified

99 return privkey, pubkey
100
101def get_multisig(node):
102 """Generate a fresh 2-of-3 multisig on node
103
104 Returns a named tuple of privkeys, pubkeys and all address and scripts."""
105 addrs = []
106 pubkeys = []
107 for _ in range(3):
108 addr = node.getaddressinfo(node.getnewaddress())
109 addrs.append(addr['address'])
110 pubkeys.append(addr['pubkey'])
111 script_code = keys_to_multisig_script(pubkeys, k=2)
112 witness_script = script_to_p2wsh_script(script_code)
113 return Multisig(privkeys=[node.dumpprivkey(addr) for addr in addrs],
114 pubkeys=pubkeys,
115 p2sh_script=script_to_p2sh_script(script_code).hex(),
116 p2sh_addr=script_to_p2sh(script_code),
117 redeem_script=script_code.hex(),
118 p2wsh_script=witness_script.hex(),
119 p2wsh_addr=script_to_p2wsh(script_code),
120 p2sh_p2wsh_script=script_to_p2sh_script(witness_script).hex(),
121 p2sh_p2wsh_addr=script_to_p2sh_p2wsh(script_code))
122
123def test_address(node, address, **kwargs):
124 """Get address info for `address` and test whether the returned values are as expected."""

Callers 1

run_testMethod · 0.90

Calls 7

keys_to_multisig_scriptFunction · 0.90
script_to_p2wsh_scriptFunction · 0.90
script_to_p2sh_scriptFunction · 0.90
script_to_p2shFunction · 0.90
script_to_p2wshFunction · 0.90
script_to_p2sh_p2wshFunction · 0.90
hexMethod · 0.80

Tested by

no test coverage detected