(node_factory, bitcoind, chainparams)
| 519 | @pytest.mark.openchannel('v2') |
| 520 | @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need') |
| 521 | def test_easy_splice_in(node_factory, bitcoind, chainparams): |
| 522 | fundamt = 1000000 |
| 523 | |
| 524 | coin_mvt_plugin = Path(__file__).parent / "plugins" / "coin_movements.py" |
| 525 | l1, l2 = node_factory.line_graph(2, fundamount=fundamt, wait_for_announce=True, |
| 526 | opts={'plugin': coin_mvt_plugin}) |
| 527 | |
| 528 | # Splice in 100k sats into first channel |
| 529 | spliceamt = 100000 |
| 530 | |
| 531 | l1.rpc.splicein("*:?", f"{spliceamt}") |
| 532 | p1 = only_one(l1.rpc.listpeerchannels(peer_id=l2.info['id'])['channels']) |
| 533 | p2 = only_one(l2.rpc.listpeerchannels(l1.info['id'])['channels']) |
| 534 | assert p1['inflight'][0]['splice_amount'] == spliceamt |
| 535 | assert p1['inflight'][0]['total_funding_msat'] == (fundamt + spliceamt) * 1000 |
| 536 | assert p1['inflight'][0]['our_funding_msat'] == fundamt * 1000 |
| 537 | assert p2['inflight'][0]['splice_amount'] == 0 |
| 538 | assert p2['inflight'][0]['total_funding_msat'] == (fundamt + spliceamt) * 1000 |
| 539 | assert p2['inflight'][0]['our_funding_msat'] == 0 |
| 540 | bitcoind.generate_block(6, wait_for_mempool=1) |
| 541 | l2.daemon.wait_for_log(r'lightningd, splice_locked clearing inflights') |
| 542 | |
| 543 | p1 = only_one(l1.rpc.listpeerchannels(peer_id=l2.info['id'])['channels']) |
| 544 | p2 = only_one(l2.rpc.listpeerchannels(l1.info['id'])['channels']) |
| 545 | assert p1['to_us_msat'] == (fundamt + spliceamt) * 1000 |
| 546 | assert p1['total_msat'] == (fundamt + spliceamt) * 1000 |
| 547 | assert p2['to_us_msat'] == 0 |
| 548 | assert p2['total_msat'] == (fundamt + spliceamt) * 1000 |
| 549 | assert 'inflight' not in p1 |
| 550 | assert 'inflight' not in p2 |
| 551 | |
| 552 | wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == 1) |
| 553 | wait_for(lambda: len(l1.rpc.listfunds()['channels']) == 1) |
| 554 | |
| 555 | |
| 556 | # Makes channels going from node 1 -> 2, 2 -> 3, etc up to 'qty' number channels. |
nothing calls this directly
no test coverage detected