(node_factory, bitcoind, executor)
| 454 | @pytest.mark.openchannel('v2') |
| 455 | @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need') |
| 456 | def test_splice_stuck_htlc(node_factory, bitcoind, executor): |
| 457 | l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True) |
| 458 | |
| 459 | l3.rpc.dev_ignore_htlcs(id=l2.info['id'], ignore=True) |
| 460 | |
| 461 | inv = l3.rpc.invoice(10000000, '1', 'no_1') |
| 462 | executor.submit(l1.rpc.xpay, inv['bolt11']) |
| 463 | l3.daemon.wait_for_log('their htlc 0 dev_ignore_htlcs') |
| 464 | |
| 465 | # Now we should have a stuck invoice between l1 -> l2 |
| 466 | |
| 467 | chan_id = l1.get_channel_id(l2) |
| 468 | |
| 469 | # add extra sats to pay fee |
| 470 | funds_result = l1.rpc.fundpsbt("111722sat", 0, 0, excess_as_change=True) |
| 471 | |
| 472 | result = l1.rpc.splice_init(chan_id, 100000, funds_result['psbt']) |
| 473 | result = l1.rpc.splice_update(chan_id, result['psbt']) |
| 474 | assert(result['commitments_secured'] is False) |
| 475 | result = l1.rpc.splice_update(chan_id, result['psbt']) |
| 476 | assert(result['commitments_secured'] is True) |
| 477 | result = l1.rpc.signpsbt(result['psbt']) |
| 478 | result = l1.rpc.splice_signed(chan_id, result['signed_psbt']) |
| 479 | |
| 480 | l2.daemon.wait_for_log(r'CHANNELD_NORMAL to CHANNELD_AWAITING_SPLICE') |
| 481 | l1.daemon.wait_for_log(r'CHANNELD_NORMAL to CHANNELD_AWAITING_SPLICE') |
| 482 | |
| 483 | wait_for(lambda: len(list(bitcoind.rpc.getrawmempool(True).keys())) == 1) |
| 484 | mempool = bitcoind.rpc.getrawmempool(True) |
| 485 | assert result['txid'] in list(mempool.keys()) |
| 486 | |
| 487 | bitcoind.generate_block(1, wait_for_mempool=1) |
| 488 | # Don't have l2, l3 reject channel_announcement as too far in future. |
| 489 | sync_blockheight(bitcoind, [l1, l2, l3]) |
| 490 | bitcoind.generate_block(5) |
| 491 | |
| 492 | l2.daemon.wait_for_log(r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL') |
| 493 | l1.daemon.wait_for_log(r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL') |
| 494 | |
| 495 | # Check that the splice doesn't generate a unilateral close transaction |
| 496 | time.sleep(5) |
| 497 | assert l1.db_query("SELECT count(*) as c FROM channeltxs;")[0]['c'] == 0 |
| 498 | |
| 499 | |
| 500 | @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need') |
nothing calls this directly
no test coverage detected