This repository was archived by the owner on Feb 3, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -1446,11 +1446,15 @@ impl<S: MutinyStorage> Node<S> {
14461446 if self . stop . load ( Ordering :: Relaxed ) {
14471447 return Err ( MutinyError :: NotRunning ) ;
14481448 }
1449- if !self . channel_manager . list_usable_channels ( ) . is_empty ( )
1450- && self . has_done_initial_sync . load ( Ordering :: SeqCst )
1451- {
1449+ let has_usable = !self . channel_manager . list_usable_channels ( ) . is_empty ( ) ;
1450+ let init = self . has_done_initial_sync . load ( Ordering :: Relaxed ) ;
1451+ if has_usable && init {
14521452 break ;
14531453 }
1454+ log_trace ! (
1455+ self . logger,
1456+ "waiting for channel to be usable, has usable channels: {has_usable} finished init sync:{init}"
1457+ ) ;
14541458 sleep ( 1_000 ) . await ;
14551459 }
14561460
Original file line number Diff line number Diff line change @@ -377,6 +377,8 @@ impl<S: MutinyStorage> NodeManagerBuilder<S> {
377377 start. elapsed( ) . as_millis( )
378378 ) ;
379379
380+ let has_done_initial_ldk_sync = Arc :: new ( AtomicBool :: new ( false ) ) ;
381+
380382 let nodes = if c. safe_mode {
381383 // If safe mode is enabled, we don't start any nodes
382384 log_warn ! ( logger, "Safe mode enabled, not starting any nodes" ) ;
@@ -404,6 +406,7 @@ impl<S: MutinyStorage> NodeManagerBuilder<S> {
404406 . with_fee_estimator ( fee_estimator. clone ( ) )
405407 . with_wallet ( wallet. clone ( ) )
406408 . with_esplora ( esplora. clone ( ) )
409+ . with_initial_sync ( has_done_initial_ldk_sync. clone ( ) )
407410 . with_network ( c. network ) ;
408411 node_builder. with_logger ( logger. clone ( ) ) ;
409412
@@ -491,7 +494,7 @@ impl<S: MutinyStorage> NodeManagerBuilder<S> {
491494 logger,
492495 do_not_connect_peers : c. do_not_connect_peers ,
493496 safe_mode : c. safe_mode ,
494- has_done_initial_ldk_sync : Arc :: new ( AtomicBool :: new ( false ) ) ,
497+ has_done_initial_ldk_sync,
495498 } ;
496499
497500 Ok ( nm)
You can’t perform that action at this time.
0 commit comments