Test simple multiwithdraw usage.
(node_factory, bitcoind, chainparams)
| 2222 | |
| 2223 | |
| 2224 | def test_multiwithdraw_simple(node_factory, bitcoind, chainparams): |
| 2225 | """ |
| 2226 | Test simple multiwithdraw usage. |
| 2227 | """ |
| 2228 | coin_plugin = os.path.join(os.getcwd(), 'tests/plugins/coin_movements.py') |
| 2229 | l1, l2, l3 = node_factory.get_nodes(3, opts=[{'plugin': coin_plugin}, |
| 2230 | {}, {}]) |
| 2231 | l1.fundwallet(10**8) |
| 2232 | |
| 2233 | addr2 = l2.rpc.newaddr('bech32')['bech32'] |
| 2234 | amount2 = Millisatoshi(2222 * 1000) |
| 2235 | addr3 = l3.rpc.newaddr('bech32')['bech32'] |
| 2236 | amount3 = Millisatoshi(3333 * 1000) |
| 2237 | |
| 2238 | # Multiwithdraw! |
| 2239 | txid = l1.rpc.multiwithdraw([{addr2: amount2}, {addr3: amount3}])["txid"] |
| 2240 | bitcoind.generate_block(1) |
| 2241 | sync_blockheight(bitcoind, [l1, l2, l3]) |
| 2242 | |
| 2243 | # l2 shoulda gotten money. |
| 2244 | funds2 = l2.rpc.listfunds()['outputs'] |
| 2245 | assert only_one(funds2)["txid"] == txid |
| 2246 | assert only_one(funds2)["address"] == addr2 |
| 2247 | assert only_one(funds2)["status"] == "confirmed" |
| 2248 | assert only_one(funds2)["amount_msat"] == amount2 |
| 2249 | |
| 2250 | # l3 shoulda gotten money. |
| 2251 | funds3 = l3.rpc.listfunds()['outputs'] |
| 2252 | assert only_one(funds3)["txid"] == txid |
| 2253 | assert only_one(funds3)["address"] == addr3 |
| 2254 | assert only_one(funds3)["status"] == "confirmed" |
| 2255 | assert only_one(funds3)["amount_msat"] == amount3 |
| 2256 | |
| 2257 | expected_utxos = { |
| 2258 | '0': [('wallet', ['deposit'], ['withdrawal'], 'A')], |
| 2259 | 'A': [('wallet', ['deposit'], None, None), |
| 2260 | ('external', ['deposit'], None, None), |
| 2261 | ('external', ['deposit'], None, None)], |
| 2262 | } |
| 2263 | |
| 2264 | check_utxos_channel(l1, [], expected_utxos) |
| 2265 | |
| 2266 | |
| 2267 | @unittest.skipIf( |
nothing calls this directly
no test coverage detected