(node_factory, bitcoind)
| 14 | @pytest.mark.openchannel('v2') |
| 15 | @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need') |
| 16 | def test_splice(node_factory, bitcoind): |
| 17 | l1, l2 = node_factory.line_graph(2, fundamount=1000000, wait_for_announce=True) |
| 18 | |
| 19 | chan_id = l1.get_channel_id(l2) |
| 20 | |
| 21 | # add extra sats to pay fee |
| 22 | funds_result = l1.rpc.fundpsbt("111722sat", 0, 0, excess_as_change=True) |
| 23 | |
| 24 | result = l1.rpc.splice_init(chan_id, 100000, funds_result['psbt']) |
| 25 | result = l1.rpc.splice_update(chan_id, result['psbt']) |
| 26 | assert(result['commitments_secured'] is False) |
| 27 | result = l1.rpc.splice_update(chan_id, result['psbt']) |
| 28 | assert(result['commitments_secured'] is True) |
| 29 | result = l1.rpc.signpsbt(result['psbt']) |
| 30 | result = l1.rpc.splice_signed(chan_id, result['signed_psbt']) |
| 31 | |
| 32 | l2.daemon.wait_for_log(r'CHANNELD_NORMAL to CHANNELD_AWAITING_SPLICE') |
| 33 | l1.daemon.wait_for_log(r'CHANNELD_NORMAL to CHANNELD_AWAITING_SPLICE') |
| 34 | |
| 35 | wait_for(lambda: len(list(bitcoind.rpc.getrawmempool(True).keys())) == 1) |
| 36 | mempool = bitcoind.rpc.getrawmempool(True) |
| 37 | assert result['txid'] in list(mempool.keys()) |
| 38 | |
| 39 | bitcoind.generate_block(6, wait_for_mempool=1) |
| 40 | |
| 41 | l2.daemon.wait_for_log(r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL') |
| 42 | l1.daemon.wait_for_log(r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL') |
| 43 | |
| 44 | inv = l2.rpc.invoice(10**2, '3', 'no_3') |
| 45 | l1.rpc.xpay(inv['bolt11']) |
| 46 | |
| 47 | # Check that the splice doesn't generate a unilateral close transaction |
| 48 | time.sleep(5) |
| 49 | assert l1.db_query("SELECT count(*) as c FROM channeltxs;")[0]['c'] == 0 |
| 50 | |
| 51 | |
| 52 | def _splice_to_inflight(l1, chan_id, amount=100000): |
nothing calls this directly
no test coverage detected