(node_factory, bitcoind)
| 482 | @pytest.mark.openchannel('v2') |
| 483 | @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need') |
| 484 | def test_script_two_chan_splice_inout(node_factory, bitcoind): |
| 485 | l1, l2, l3 = node_factory.line_graph(3, fundamount=1000000, wait_for_announce=True) |
| 486 | |
| 487 | chan_id1 = l2.get_channel_id(l1) |
| 488 | chan_id2 = l2.get_channel_id(l3) |
| 489 | |
| 490 | # move sats from chan 2 into chan 1 |
| 491 | # By adding 100000 from wallet, the fee will be taken from this and the |
| 492 | # extra placed back into the wallet by default |
| 493 | result = l2.rpc.splice(f"wallet -> 100000; 100000 -> {chan_id1}; {chan_id2} -> 100000") |
| 494 | |
| 495 | l3.daemon.wait_for_log(r'CHANNELD_NORMAL to CHANNELD_AWAITING_SPLICE') |
| 496 | l2.daemon.wait_for_log(r'CHANNELD_NORMAL to CHANNELD_AWAITING_SPLICE') |
| 497 | l1.daemon.wait_for_log(r'CHANNELD_NORMAL to CHANNELD_AWAITING_SPLICE') |
| 498 | |
| 499 | wait_for(lambda: len(list(bitcoind.rpc.getrawmempool(True).keys())) == 1) |
| 500 | assert result['txid'] in list(bitcoind.rpc.getrawmempool(True).keys()) |
| 501 | |
| 502 | bitcoind.generate_block(6, wait_for_mempool=1) |
| 503 | |
| 504 | l3.daemon.wait_for_log(r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL') |
| 505 | l2.daemon.wait_for_log(r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL') |
| 506 | l1.daemon.wait_for_log(r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL') |
| 507 | |
| 508 | # l2 should now have funds on their side to pay l1 |
| 509 | inv = l1.rpc.invoice(10000, '2', 'no_2') |
| 510 | l2.rpc.pay(inv['bolt11']) |
| 511 | |
| 512 | # l2 spliced extra funds into chan with l3 (but l3 still has 0 on their side) |
| 513 | # Send a payment l2->l3 just to check for channel stability |
| 514 | inv = l3.rpc.invoice(10000, '3', 'no_3') |
| 515 | l2.rpc.pay(inv['bolt11']) |
| 516 | |
| 517 | |
| 518 | @pytest.mark.openchannel('v1') |
nothing calls this directly
no test coverage detected