@@ -16,7 +16,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
1616use common:: {
1717 expect_channel_ready_event, expect_event, generate_blocks_and_wait, open_channel,
1818 premine_and_distribute_funds, random_chain_source, random_config, setup_bitcoind_and_electrsd,
19- setup_node, TestNode ,
19+ setup_node, wait_for_channel_ready_to_send , TestNode ,
2020} ;
2121
2222use ldk_node:: bitcoin:: Amount ;
@@ -159,7 +159,9 @@ async fn probe_budget_increments_and_decrements() {
159159
160160 // Build the probe path now that channels are ready, then enable probing.
161161 strategy. set_path ( build_probe_path ( & node_a, & node_b, & node_c, PROBE_AMOUNT_MSAT ) ) ;
162- tokio:: time:: sleep ( Duration :: from_secs ( 3 ) ) . await ;
162+ // First hop carries amount + per-hop fee; second hop carries just amount.
163+ wait_for_channel_ready_to_send ( & node_a, & node_b, PROBE_AMOUNT_MSAT + 1000 ) . await ;
164+ wait_for_channel_ready_to_send ( & node_b, & node_c, PROBE_AMOUNT_MSAT ) . await ;
163165 strategy. start_probing ( ) ;
164166
165167 let went_up = tokio:: time:: timeout ( Duration :: from_secs ( 30 ) , async {
@@ -243,7 +245,8 @@ async fn exhausted_probe_budget_blocks_new_probes() {
243245 assert_eq ! ( node_a. prober( ) . map_or( 1 , |p| p. locked_msat( ) ) , 0 , "initial locked_msat is nonzero" ) ;
244246
245247 strategy. set_path ( build_probe_path ( & node_a, & node_b, & node_c, PROBE_AMOUNT_MSAT ) ) ;
246- tokio:: time:: sleep ( Duration :: from_secs ( 3 ) ) . await ;
248+ wait_for_channel_ready_to_send ( & node_a, & node_b, PROBE_AMOUNT_MSAT + 1000 ) . await ;
249+ wait_for_channel_ready_to_send ( & node_b, & node_c, PROBE_AMOUNT_MSAT ) . await ;
247250 strategy. start_probing ( ) ;
248251
249252 // Sample locked_msat across multiple probe cycles and assert the budget cap is never exceeded
0 commit comments