@@ -195,3 +195,35 @@ def test_script_splice_in(node_factory, bitcoind, chainparams):
195
195
l1 .wait_for_channel_onchain (l2 .info ['id' ])
196
196
account_info = only_one ([acct for acct in l1 .rpc .bkpr_listbalances ()['accounts' ] if acct ['account' ] == account_id ])
197
197
assert not account_info ['account_closed' ]
198
+
199
+
200
+ @pytest .mark .openchannel ('v1' )
201
+ @pytest .mark .openchannel ('v2' )
202
+ @unittest .skipIf (TEST_NETWORK != 'regtest' , 'elementsd doesnt yet support PSBT features we need' )
203
+ def test_script_two_chan_splice_in (node_factory , bitcoind ):
204
+ l1 , l2 , l3 = node_factory .line_graph (3 , fundamount = 1000000 , wait_for_announce = True , opts = {'experimental-splicing' : None })
205
+
206
+ chan_id1 = l2 .get_channel_id (l1 )
207
+ chan_id2 = l2 .get_channel_id (l3 )
208
+
209
+ # l2 will splice funds into the channels with l1 and l3 at the same time
210
+ result = l2 .rpc .splice (f"wallet -> 200999; 100000 -> { chan_id1 } ; 100000 -> { chan_id2 } ; * -> wallet" , force_feerate = True , debug_log = True )
211
+
212
+ l3 .daemon .wait_for_log (r'CHANNELD_NORMAL to CHANNELD_AWAITING_SPLICE' )
213
+ l2 .daemon .wait_for_log (r'CHANNELD_NORMAL to CHANNELD_AWAITING_SPLICE' )
214
+ l1 .daemon .wait_for_log (r'CHANNELD_NORMAL to CHANNELD_AWAITING_SPLICE' )
215
+
216
+ wait_for (lambda : len (list (bitcoind .rpc .getrawmempool (True ).keys ())) == 1 )
217
+ assert result ['txid' ] in list (bitcoind .rpc .getrawmempool (True ).keys ())
218
+
219
+ bitcoind .generate_block (6 , wait_for_mempool = 1 )
220
+
221
+ l3 .daemon .wait_for_log (r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL' )
222
+ l2 .daemon .wait_for_log (r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL' )
223
+ l1 .daemon .wait_for_log (r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL' )
224
+
225
+ inv = l2 .rpc .invoice (10 ** 2 , '1' , 'no_1' )
226
+ l1 .rpc .pay (inv ['bolt11' ])
227
+
228
+ inv = l3 .rpc .invoice (10 ** 2 , '2' , 'no_2' )
229
+ l2 .rpc .pay (inv ['bolt11' ])
0 commit comments