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

Function test_multiwithdraw_simple

tests/test_wallet.py:1390–1430  ·  view source on GitHub ↗

Test simple multiwithdraw usage.

(node_factory, bitcoind, chainparams)

Source from the content-addressed store, hash-verified

1388
1389
1390def test_multiwithdraw_simple(node_factory, bitcoind, chainparams):
1391 """
1392 Test simple multiwithdraw usage.
1393 """
1394 coin_plugin = os.path.join(os.getcwd(), 'tests/plugins/coin_movements.py')
1395 l1, l2, l3 = node_factory.get_nodes(3, opts=[{'plugin': coin_plugin},
1396 {}, {}])
1397 l1.fundwallet(10**8)
1398
1399 addr2 = l2.rpc.newaddr()['bech32']
1400 amount2 = Millisatoshi(2222 * 1000)
1401 addr3 = l3.rpc.newaddr()['bech32']
1402 amount3 = Millisatoshi(3333 * 1000)
1403
1404 # Multiwithdraw!
1405 txid = l1.rpc.multiwithdraw([{addr2: amount2}, {addr3: amount3}])["txid"]
1406 bitcoind.generate_block(1)
1407 sync_blockheight(bitcoind, [l1, l2, l3])
1408
1409 # l2 shoulda gotten money.
1410 funds2 = l2.rpc.listfunds()['outputs']
1411 assert only_one(funds2)["txid"] == txid
1412 assert only_one(funds2)["address"] == addr2
1413 assert only_one(funds2)["status"] == "confirmed"
1414 assert only_one(funds2)["amount_msat"] == amount2
1415
1416 # l3 shoulda gotten money.
1417 funds3 = l3.rpc.listfunds()['outputs']
1418 assert only_one(funds3)["txid"] == txid
1419 assert only_one(funds3)["address"] == addr3
1420 assert only_one(funds3)["status"] == "confirmed"
1421 assert only_one(funds3)["amount_msat"] == amount3
1422
1423 expected_utxos = {
1424 '0': [('wallet', ['deposit'], ['withdrawal'], 'A')],
1425 'A': [('wallet', ['deposit'], None, None),
1426 ('external', ['deposit'], None, None),
1427 ('external', ['deposit'], None, None)],
1428 }
1429
1430 check_utxos_channel(l1, [], expected_utxos)
1431
1432
1433@unittest.skipIf(

Callers

nothing calls this directly

Calls 11

MillisatoshiClass · 0.90
sync_blockheightFunction · 0.90
only_oneFunction · 0.90
check_utxos_channelFunction · 0.90
joinMethod · 0.80
get_nodesMethod · 0.80
fundwalletMethod · 0.80
multiwithdrawMethod · 0.80
generate_blockMethod · 0.80
newaddrMethod · 0.45
listfundsMethod · 0.45

Tested by

no test coverage detected