MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_sign_external_psbt

Function test_sign_external_psbt

tests/test_wallet.py:951–976  ·  view source on GitHub ↗

A PSBT w/ one of our inputs should be signable (we can fill in the required UTXO data).

(node_factory, bitcoind, chainparams)

Source from the content-addressed store, hash-verified

949
950
951def test_sign_external_psbt(node_factory, bitcoind, chainparams):
952 """
953 A PSBT w/ one of our inputs should be signable (we can fill
954 in the required UTXO data).
955 """
956 l1 = node_factory.get_node(feerates=(7500, 7500, 7500, 7500))
957 amount = 1000000
958 total_outs = 4
959
960 # Add a medley of funds to withdraw later
961 for i in range(total_outs):
962 bitcoind.rpc.sendtoaddress(l1.rpc.newaddr('bech32')['bech32'],
963 amount / 10**8)
964
965 bitcoind.generate_block(1)
966 wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == total_outs)
967
968 # Build a PSBT using all our inputs, externally
969 inputs = []
970 for inp in l1.rpc.listfunds()['outputs']:
971 inputs.append({'txid': inp['txid'], 'vout': inp['output']})
972 addr = l1.rpc.newaddr('bech32')['bech32']
973 psbt = bitcoind.rpc.createpsbt(inputs, [{addr: (amount * 3) / 10**8}])
974
975 l1.rpc.reserveinputs(psbt)
976 l1.rpc.signpsbt(psbt)
977
978
979def test_sign_signed_psbt(node_factory, bitcoind, chainparams):

Callers

nothing calls this directly

Calls 7

wait_forFunction · 0.90
generate_blockMethod · 0.80
reserveinputsMethod · 0.80
signpsbtMethod · 0.80
get_nodeMethod · 0.45
newaddrMethod · 0.45
listfundsMethod · 0.45

Tested by

no test coverage detected