@@ -206,13 +206,15 @@ async fn run_expire_hodl_invoice_case(
206206
207207async fn setup_two_nodes_with_asset_channel (
208208 test_dir_suffix : & str ,
209- port_offset : u16 ,
210209) -> ( SocketAddr , SocketAddr , String , String , String ) {
211210 let test_dir_base = format ! ( "{TEST_DIR_BASE}{test_dir_suffix}/" ) ;
212211 let test_dir_node1 = format ! ( "{test_dir_base}node1" ) ;
213212 let test_dir_node2 = format ! ( "{test_dir_base}node2" ) ;
214- let node1_port = NODE1_PEER_PORT + port_offset;
215- let node2_port = NODE2_PEER_PORT + port_offset;
213+ let node1_port = next_peer_port ( ) ;
214+ let mut node2_port = next_peer_port ( ) ;
215+ while node2_port == node1_port {
216+ node2_port = next_peer_port ( ) ;
217+ }
216218 let ( node1_addr, _) = start_node ( & test_dir_node1, node1_port, false ) . await ;
217219 let ( node2_addr, _) = start_node ( & test_dir_node2, node2_port, false ) . await ;
218220
@@ -306,7 +308,7 @@ async fn autoclaim_and_expire_hodl_invoice_time_and_blocks() {
306308 initialize ( ) ;
307309
308310 let ( node1_addr, node2_addr, _test_dir_node1, test_dir_node2, _asset_id) =
309- setup_two_nodes_with_asset_channel ( "autoclaim-expiry" , 10 ) . await ;
311+ setup_two_nodes_with_asset_channel ( "autoclaim-expiry" ) . await ;
310312
311313 run_auto_claim_invoice_regression_case ( node1_addr, node2_addr) . await ;
312314 run_expire_hodl_invoice_case ( node1_addr, node2_addr, & test_dir_node2, ExpiryTrigger :: Time )
@@ -318,6 +320,8 @@ async fn autoclaim_and_expire_hodl_invoice_time_and_blocks() {
318320 ExpiryTrigger :: Blocks ,
319321 )
320322 . await ;
323+
324+ shutdown ( & [ node1_addr, node2_addr] ) . await ;
321325}
322326
323327#[ serial_test:: serial]
@@ -328,7 +332,7 @@ async fn cancel_hodl_invoice_btc_rgb() {
328332
329333 let asset_payment_amount = 10 ;
330334 let ( node1_addr, node2_addr, _test_dir_node1, test_dir_node2, asset_id) =
331- setup_two_nodes_with_asset_channel ( "cancel-btc-rgb-rgb" , 20 ) . await ;
335+ setup_two_nodes_with_asset_channel ( "cancel-btc-rgb-rgb" ) . await ;
332336 let initial_ln_rgb_balance_node1 = asset_balance_offchain_outbound ( node1_addr, & asset_id) . await ;
333337 let initial_ln_rgb_balance_node2 = asset_balance_offchain_outbound ( node2_addr, & asset_id) . await ;
334338
@@ -417,6 +421,8 @@ async fn cancel_hodl_invoice_btc_rgb() {
417421
418422 wait_for_ln_balance ( node1_addr, & asset_id, initial_ln_rgb_balance_node1) . await ;
419423 wait_for_ln_balance ( node2_addr, & asset_id, initial_ln_rgb_balance_node2) . await ;
424+
425+ shutdown ( & [ node1_addr, node2_addr] ) . await ;
420426}
421427
422428#[ serial_test:: serial]
@@ -427,7 +433,7 @@ async fn claim_hodl_invoice_btc_rgb() {
427433
428434 let asset_payment_amount = 10 ;
429435 let ( node1_addr, node2_addr, _test_dir_node1, test_dir_node2, asset_id) =
430- setup_two_nodes_with_asset_channel ( "settle-btc-rgb" , 30 ) . await ;
436+ setup_two_nodes_with_asset_channel ( "settle-btc-rgb" ) . await ;
431437
432438 let initial_ln_balance_node1 = asset_balance_offchain_outbound ( node1_addr, & asset_id) . await ;
433439 let initial_ln_balance_node2 = asset_balance_offchain_outbound ( node2_addr, & asset_id) . await ;
@@ -454,6 +460,7 @@ async fn claim_hodl_invoice_btc_rgb() {
454460 asset_id : None ,
455461 asset_amount : None ,
456462 payment_hash : Some ( payment_hash. clone ( ) ) ,
463+ description_hash : None ,
457464 } ;
458465 let duplicate_hash_res = reqwest:: Client :: new ( )
459466 . post ( format ! ( "http://{node2_addr}/lninvoice" ) )
@@ -470,10 +477,6 @@ async fn claim_hodl_invoice_btc_rgb() {
470477 . await ;
471478
472479 let _ = send_payment_with_status ( node1_addr, invoice. clone ( ) , HTLCStatus :: Pending ) . await ;
473- assert ! ( matches!(
474- invoice_status( node2_addr, & invoice) . await ,
475- InvoiceStatus :: Pending
476- ) ) ;
477480 wait_for_claimable_state ( & test_dir_node2, & payment_hash, true )
478481 . await
479482 . unwrap_or_else ( |err| panic ! ( "wait for claimable entry to appear: {err}" ) ) ;
@@ -629,4 +632,6 @@ async fn claim_hodl_invoice_btc_rgb() {
629632 "InvoiceAlreadyClaimed" ,
630633 )
631634 . await ;
635+
636+ shutdown ( & [ node1_addr, node2_addr] ) . await ;
632637}
0 commit comments