(node_factory, bitcoind)
| 480 | @pytest.mark.openchannel('v2') |
| 481 | @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need') |
| 482 | def test_splice_out(node_factory, bitcoind): |
| 483 | l1, l2 = node_factory.line_graph(2, fundamount=1000000, wait_for_announce=True) |
| 484 | |
| 485 | chan_id = l1.get_channel_id(l2) |
| 486 | |
| 487 | funds_result = l1.rpc.addpsbtoutput(100000) |
| 488 | |
| 489 | # Pay with fee by subjtracting 5801 from channel balance |
| 490 | result = l1.rpc.splice_init(chan_id, -105801, funds_result['psbt']) |
| 491 | result = l1.rpc.splice_update(chan_id, result['psbt']) |
| 492 | assert(result['commitments_secured'] is False) |
| 493 | result = l1.rpc.splice_update(chan_id, result['psbt']) |
| 494 | assert(result['commitments_secured'] is True) |
| 495 | result = l1.rpc.splice_signed(chan_id, result['psbt']) |
| 496 | |
| 497 | l2.daemon.wait_for_log(r'CHANNELD_NORMAL to CHANNELD_AWAITING_SPLICE') |
| 498 | l1.daemon.wait_for_log(r'CHANNELD_NORMAL to CHANNELD_AWAITING_SPLICE') |
| 499 | |
| 500 | wait_for(lambda: len(list(bitcoind.rpc.getrawmempool(True).keys())) == 1) |
| 501 | mempool = bitcoind.rpc.getrawmempool(True) |
| 502 | assert result['txid'] in list(mempool.keys()) |
| 503 | |
| 504 | bitcoind.generate_block(6, wait_for_mempool=1) |
| 505 | |
| 506 | l2.daemon.wait_for_log(r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL') |
| 507 | l1.daemon.wait_for_log(r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL') |
| 508 | |
| 509 | inv = l2.rpc.invoice(10**2, '3', 'no_3') |
| 510 | l1.rpc.xpay(inv['bolt11']) |
| 511 | |
| 512 | # Check that the splice doesn't generate a unilateral close transaction |
| 513 | time.sleep(5) |
| 514 | assert l1.db_query("SELECT count(*) as c FROM channeltxs;")[0]['c'] == 0 |
| 515 | |
| 516 | |
| 517 | @pytest.mark.openchannel('v1') |
nothing calls this directly
no test coverage detected