From c6186829dfa2c7dc7eee741790420159cd137bd1 Mon Sep 17 00:00:00 2001 From: ZmnSCPxj jxPCSnmZ Date: Wed, 9 Sep 2020 19:56:14 +0930 Subject: [PATCH] tests/test_wallet.py: Simple multiwithdraw tests. --- tests/test_wallet.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/test_wallet.py b/tests/test_wallet.py index 6db25d899..8e285cfc8 100644 --- a/tests/test_wallet.py +++ b/tests/test_wallet.py @@ -1102,3 +1102,35 @@ def test_withdraw_nlocktime_fuzz(node_factory, bitcoind): return else: raise Exception("No transaction with fuzzed nLockTime !") + + +def test_multiwithdraw_simple(node_factory, bitcoind): + """ + Test simple multiwithdraw usage. + """ + l1, l2, l3 = node_factory.get_nodes(3) + l1.fundwallet(10**8) + + addr2 = l2.rpc.newaddr()['bech32'] + amount2 = Millisatoshi(2222 * 1000) + addr3 = l3.rpc.newaddr()['bech32'] + amount3 = Millisatoshi(3333 * 1000) + + # Multiwithdraw! + txid = l1.rpc.multiwithdraw([{addr2: amount2}, {addr3: amount3}])["txid"] + bitcoind.generate_block(1) + sync_blockheight(bitcoind, [l1, l2, l3]) + + # l2 shoulda gotten money. + funds2 = l2.rpc.listfunds()['outputs'] + assert only_one(funds2)["txid"] == txid + assert only_one(funds2)["address"] == addr2 + assert only_one(funds2)["status"] == "confirmed" + assert only_one(funds2)["amount_msat"] == amount2 + + # l3 shoulda gotten money. + funds3 = l3.rpc.listfunds()['outputs'] + assert only_one(funds3)["txid"] == txid + assert only_one(funds3)["address"] == addr3 + assert only_one(funds3)["status"] == "confirmed" + assert only_one(funds3)["amount_msat"] == amount3