@@ -151,7 +151,7 @@ pub(crate) async fn run_interop_scenario<N, E, F>(
151151}
152152
153153/// Open a channel, send a BOLT11 payment in each direction, then cooperatively close.
154- pub ( crate ) async fn basic_channel_cycle_scenario < E : ElectrumApi > (
154+ pub ( crate ) async fn basic_channel_cycle_bolt11_scenario < E : ElectrumApi > (
155155 node : & Node , peer : & ( impl ExternalNode + ?Sized ) , bitcoind : & BitcoindClient , electrs : & E ,
156156) {
157157 let ( user_ch, ext_ch) = channel:: open_channel_to_external (
@@ -164,12 +164,32 @@ pub(crate) async fn basic_channel_cycle_scenario<E: ElectrumApi>(
164164 )
165165 . await ;
166166
167- payment:: send_bolt11_to_peer ( node, peer, 10_000_000 , "basic-send" ) . await ;
167+ payment:: send_bolt11_to_peer ( node, peer, 10_000_000 , "basic-send-bolt11 " ) . await ;
168168 payment:: receive_bolt11_payment ( node, peer, 10_000_000 ) . await ;
169169
170170 channel:: cooperative_close ( node, peer, bitcoind, electrs, & user_ch, & ext_ch, Side :: Ldk ) . await ;
171171}
172172
173+ /// Open a channel, send a BOLT12 payment in each direction, then cooperatively close.
174+ pub ( crate ) async fn basic_channel_cycle_bolt12_scenario < E : ElectrumApi > (
175+ node : & Node , peer : & ( impl ExternalNode + ?Sized ) , bitcoind : & BitcoindClient , electrs : & E ,
176+ ) {
177+ let ( user_ch, ext_ch) = channel:: open_channel_to_external (
178+ node,
179+ peer,
180+ bitcoind,
181+ electrs,
182+ 1_000_000 ,
183+ Some ( 500_000_000 ) ,
184+ )
185+ . await ;
186+
187+ payment:: send_bolt12_to_peer ( node, peer, 10_000_000 , "basic-send-bolt12" ) . await ;
188+ payment:: receive_bolt12_payment ( node, peer, 10_000_000 ) . await ;
189+
190+ channel:: cooperative_close ( node, peer, bitcoind, electrs, & user_ch, & ext_ch, Side :: Ldk ) . await ;
191+ }
192+
173193/// Open a channel, send keysend in both directions, then cooperatively close.
174194pub ( crate ) async fn keysend_scenario < E : ElectrumApi > (
175195 node : & Node , peer : & ( impl ExternalNode + ?Sized ) , bitcoind : & BitcoindClient , electrs : & E ,
@@ -188,8 +208,8 @@ pub(crate) async fn keysend_scenario<E: ElectrumApi>(
188208 channel:: cooperative_close ( node, peer, bitcoind, electrs, & user_ch, & ext_ch, Side :: Ldk ) . await ;
189209}
190210
191- /// Open a channel, send a payment, then force-close from the LDK side.
192- pub ( crate ) async fn force_close_after_payment_scenario < E : ElectrumApi > (
211+ /// Open a channel, send a BOLT11 payment, then force-close from the LDK side.
212+ pub ( crate ) async fn force_close_after_payment_bolt11_scenario < E : ElectrumApi > (
193213 node : & Node , peer : & ( impl ExternalNode + ?Sized ) , bitcoind : & BitcoindClient , electrs : & E ,
194214) {
195215 let ( user_ch, ext_ch) = channel:: open_channel_to_external (
@@ -201,7 +221,25 @@ pub(crate) async fn force_close_after_payment_scenario<E: ElectrumApi>(
201221 Some ( 500_000_000 ) ,
202222 )
203223 . await ;
204- payment:: send_bolt11_to_peer ( node, peer, 5_000_000 , "force-close" ) . await ;
224+ payment:: send_bolt11_to_peer ( node, peer, 5_000_000 , "force-close-bolt11" ) . await ;
225+ wait_for_htlcs_settled ( peer, & ext_ch) . await ;
226+ channel:: force_close ( node, peer, bitcoind, electrs, & user_ch, & ext_ch, Side :: Ldk ) . await ;
227+ }
228+
229+ /// Open a channel, send a BOLT12 payment, then force-close from the LDK side.
230+ pub ( crate ) async fn force_close_after_payment_bolt12_scenario < E : ElectrumApi > (
231+ node : & Node , peer : & ( impl ExternalNode + ?Sized ) , bitcoind : & BitcoindClient , electrs : & E ,
232+ ) {
233+ let ( user_ch, ext_ch) = channel:: open_channel_to_external (
234+ node,
235+ peer,
236+ bitcoind,
237+ electrs,
238+ 1_000_000 ,
239+ Some ( 500_000_000 ) ,
240+ )
241+ . await ;
242+ payment:: send_bolt12_to_peer ( node, peer, 5_000_000 , "force-close-bolt12" ) . await ;
205243 wait_for_htlcs_settled ( peer, & ext_ch) . await ;
206244 channel:: force_close ( node, peer, bitcoind, electrs, & user_ch, & ext_ch, Side :: Ldk ) . await ;
207245}
@@ -225,8 +263,33 @@ pub(crate) async fn disconnect_during_payment_scenario<E: ElectrumApi>(
225263 channel:: cooperative_close ( node, peer, bitcoind, electrs, & user_ch, & ext_ch, Side :: Ldk ) . await ;
226264}
227265
228- /// Open a channel, splice-in additional funds, send a post-splice payment, then close.
229- pub ( crate ) async fn splice_in_scenario < E : ElectrumApi > (
266+ /// Open a channel, splice-in additional funds, send a post-splice BOLT11 payment, then close.
267+ pub ( crate ) async fn splice_in_bolt11_scenario < E : ElectrumApi > (
268+ node : & Node , peer : & ( impl ExternalNode + ?Sized ) , bitcoind : & BitcoindClient , electrs : & E ,
269+ ) {
270+ let ( user_ch, ext_ch) = channel:: open_channel_to_external (
271+ node,
272+ peer,
273+ bitcoind,
274+ electrs,
275+ 1_000_000 ,
276+ Some ( 500_000_000 ) ,
277+ )
278+ . await ;
279+ let ext_node_id = peer. get_node_id ( ) . await . unwrap ( ) ;
280+ node. splice_in ( & user_ch, ext_node_id, 500_000 ) . unwrap ( ) ;
281+ expect_splice_pending_event ! ( node, ext_node_id) ;
282+ generate_blocks_and_wait ( bitcoind, electrs, 6 ) . await ;
283+ sync_wallets_with_retry ( node) . await ;
284+ expect_channel_ready_event ! ( node, ext_node_id) ;
285+
286+ payment:: send_bolt11_to_peer ( node, peer, 5_000_000 , "post-splice-bolt11" ) . await ;
287+
288+ channel:: cooperative_close ( node, peer, bitcoind, electrs, & user_ch, & ext_ch, Side :: Ldk ) . await ;
289+ }
290+
291+ /// Open a channel, splice-in additional funds, send a post-splice BOLT12 payment, then close.
292+ pub ( crate ) async fn splice_in_bolt12_scenario < E : ElectrumApi > (
230293 node : & Node , peer : & ( impl ExternalNode + ?Sized ) , bitcoind : & BitcoindClient , electrs : & E ,
231294) {
232295 let ( user_ch, ext_ch) = channel:: open_channel_to_external (
@@ -245,7 +308,7 @@ pub(crate) async fn splice_in_scenario<E: ElectrumApi>(
245308 sync_wallets_with_retry ( node) . await ;
246309 expect_channel_ready_event ! ( node, ext_node_id) ;
247310
248- payment:: send_bolt11_to_peer ( node, peer, 5_000_000 , "post-splice" ) . await ;
311+ payment:: send_bolt12_to_peer ( node, peer, 5_000_000 , "post-splice-bolt12 " ) . await ;
249312
250313 channel:: cooperative_close ( node, peer, bitcoind, electrs, & user_ch, & ext_ch, Side :: Ldk ) . await ;
251314}
0 commit comments