MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_easy_splice_out

Function test_easy_splice_out

tests/test_splice.py:833–858  ·  view source on GitHub ↗
(node_factory, bitcoind, chainparams)

Source from the content-addressed store, hash-verified

831@pytest.mark.openchannel('v2')
832@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
833def test_easy_splice_out(node_factory, bitcoind, chainparams):
834 fundamt = 1000000
835
836 coin_mvt_plugin = Path(__file__).parent / "plugins" / "coin_movements.py"
837 l1, l2 = node_factory.line_graph(2, fundamount=fundamt, wait_for_announce=True,
838 opts={'plugin': coin_mvt_plugin})
839
840 initial_wallet_balance = Millisatoshi(bkpr_account_balance(l1, 'wallet'))
841
842 # Splice out 100k from first channel, putting result less fees into onchain wallet
843 spliceamt = 100000
844 l1.rpc.spliceout("*:?", f"{spliceamt}", force_feerate=True)
845
846 bitcoind.generate_block(6, wait_for_mempool=1)
847 l2.daemon.wait_for_log(r'lightningd, splice_locked clearing inflights')
848
849 p1 = only_one(l1.rpc.listpeerchannels(peer_id=l2.info['id'])['channels'])
850 p2 = only_one(l2.rpc.listpeerchannels(l1.info['id'])['channels'])
851 assert 'inflight' not in p1
852 assert 'inflight' not in p2
853
854 wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == 2)
855 wait_for(lambda: len(l1.rpc.listfunds()['channels']) == 1)
856
857 end_wallet_balance = Millisatoshi(bkpr_account_balance(l1, 'wallet'))
858 assert initial_wallet_balance + Millisatoshi(spliceamt * 1000) == end_wallet_balance
859
860
861@pytest.mark.xfail(strict=True)

Callers

nothing calls this directly

Calls 10

MillisatoshiClass · 0.90
bkpr_account_balanceFunction · 0.90
only_oneFunction · 0.90
wait_forFunction · 0.90
line_graphMethod · 0.80
spliceoutMethod · 0.80
generate_blockMethod · 0.80
wait_for_logMethod · 0.80
listpeerchannelsMethod · 0.80
listfundsMethod · 0.45

Tested by

no test coverage detected