(node_factory, bitcoind)
| 575 | @pytest.mark.openchannel('v2') |
| 576 | @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need') |
| 577 | def test_commit_crash_splice(node_factory, bitcoind): |
| 578 | # Here we do a normal splice out but force a restart after commiting. |
| 579 | l1, l2 = node_factory.line_graph(2, fundamount=1000000, wait_for_announce=True, opts={'may_reconnect': True}) |
| 580 | |
| 581 | chan_id = l1.get_channel_id(l2) |
| 582 | |
| 583 | result = l1.rpc.splice_init(chan_id, -105801, l1.rpc.addpsbtoutput(100000)['psbt']) |
| 584 | result = l1.rpc.splice_update(chan_id, result['psbt']) |
| 585 | assert(result['commitments_secured'] is False) |
| 586 | result = l1.rpc.splice_update(chan_id, result['psbt']) |
| 587 | assert(result['commitments_secured'] is True) |
| 588 | |
| 589 | l1.daemon.wait_for_log(r"Splice initiator: we commit") |
| 590 | |
| 591 | l1.restart() |
| 592 | |
| 593 | # The splicing inflight should have been left pending in the DB |
| 594 | assert l1.db_query("SELECT count(*) as c FROM channel_funding_inflights;")[0]['c'] == 1 |
| 595 | |
| 596 | l1.daemon.wait_for_log(r'peer_out WIRE_CHANNEL_REESTABLISH') |
| 597 | l1.daemon.wait_for_log(r'Got reestablish commit=1 revoke=0 inflights: 1, active splices: 1') |
| 598 | l1.daemon.wait_for_log(r'Splice resume check with local_next_funding: sent, remote_next_funding: received, inflights: 1') |
| 599 | l1.daemon.wait_for_log(r'Splice negotation, will not send commit, not recv commit, send signature, recv signature as initiator') |
| 600 | |
| 601 | assert l1.db_query("SELECT count(*) as c FROM channel_funding_inflights;")[0]['c'] == 1 |
| 602 | |
| 603 | l2.daemon.wait_for_log(r'CHANNELD_NORMAL to CHANNELD_AWAITING_SPLICE') |
| 604 | l1.daemon.wait_for_log(r'CHANNELD_NORMAL to CHANNELD_AWAITING_SPLICE') |
| 605 | |
| 606 | wait_for(lambda: len(list(bitcoind.rpc.getrawmempool(True).keys())) == 1) |
| 607 | |
| 608 | bitcoind.generate_block(6, wait_for_mempool=1) |
| 609 | |
| 610 | l2.daemon.wait_for_log(r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL') |
| 611 | l1.daemon.wait_for_log(r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL') |
| 612 | |
| 613 | time.sleep(5) |
| 614 | |
| 615 | assert l1.db_query("SELECT count(*) as c FROM channel_funding_inflights;")[0]['c'] == 0 |
| 616 | |
| 617 | inv = l2.rpc.invoice(10**2, '3', 'no_3') |
| 618 | l1.rpc.xpay(inv['bolt11']) |
| 619 | |
| 620 | # Check that the splice doesn't generate a unilateral close transaction |
| 621 | time.sleep(5) |
| 622 | assert l1.db_query("SELECT count(*) as c FROM channeltxs;")[0]['c'] == 0 |
| 623 | |
| 624 | |
| 625 | @pytest.mark.openchannel('v1') |
nothing calls this directly
no test coverage detected