File tree Expand file tree Collapse file tree 3 files changed +33
-19
lines changed Expand file tree Collapse file tree 3 files changed +33
-19
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ impl Writeable for UserOnionMessageContents {
6060 }
6161}
6262
63- pub ( crate ) async fn poll_for_user_input (
63+ pub ( crate ) fn poll_for_user_input (
6464 peer_manager : Arc < PeerManager > , channel_manager : Arc < ChannelManager > ,
6565 keys_manager : Arc < KeysManager > , network_graph : Arc < NetworkGraph > ,
6666 onion_messenger : Arc < OnionMessenger > , inbound_payments : Arc < Mutex < PaymentInfoStorage > > ,
@@ -112,8 +112,12 @@ pub(crate) async fn poll_for_user_input(
112112 continue ;
113113 }
114114
115- if connect_peer_if_necessary ( pubkey, peer_addr, peer_manager. clone ( ) )
116- . await
115+ if tokio:: runtime:: Handle :: current ( )
116+ . block_on ( connect_peer_if_necessary (
117+ pubkey,
118+ peer_addr,
119+ peer_manager. clone ( ) ,
120+ ) )
117121 . is_err ( )
118122 {
119123 continue ;
@@ -259,8 +263,12 @@ pub(crate) async fn poll_for_user_input(
259263 continue ;
260264 }
261265 } ;
262- if connect_peer_if_necessary ( pubkey, peer_addr, peer_manager. clone ( ) )
263- . await
266+ if tokio:: runtime:: Handle :: current ( )
267+ . block_on ( connect_peer_if_necessary (
268+ pubkey,
269+ peer_addr,
270+ peer_manager. clone ( ) ,
271+ ) )
264272 . is_ok ( )
265273 {
266274 println ! ( "SUCCESS: connected to peer {}" , pubkey) ;
Original file line number Diff line number Diff line change @@ -943,19 +943,25 @@ async fn start_ldk() {
943943 ) ) ;
944944
945945 // Start the CLI.
946- let cli_poll = tokio:: spawn ( cli:: poll_for_user_input (
947- Arc :: clone ( & peer_manager) ,
948- Arc :: clone ( & channel_manager) ,
949- Arc :: clone ( & keys_manager) ,
950- Arc :: clone ( & network_graph) ,
951- Arc :: clone ( & onion_messenger) ,
952- inbound_payments,
953- outbound_payments,
954- ldk_data_dir,
955- network,
956- Arc :: clone ( & logger) ,
957- Arc :: clone ( & persister) ,
958- ) ) ;
946+ let cli_channel_manager = Arc :: clone ( & channel_manager) ;
947+ let cli_persister = Arc :: clone ( & persister) ;
948+ let cli_logger = Arc :: clone ( & logger) ;
949+ let cli_peer_manager = Arc :: clone ( & peer_manager) ;
950+ let cli_poll = tokio:: task:: spawn_blocking ( move || {
951+ cli:: poll_for_user_input (
952+ cli_peer_manager,
953+ cli_channel_manager,
954+ keys_manager,
955+ network_graph,
956+ onion_messenger,
957+ inbound_payments,
958+ outbound_payments,
959+ ldk_data_dir,
960+ network,
961+ cli_logger,
962+ cli_persister,
963+ )
964+ } ) ;
959965
960966 // Exit if either CLI polling exits or the background processor exits (which shouldn't happen
961967 // unless we fail to write to the filesystem).
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ pub(crate) async fn periodic_sweep(
3636 // Note that if you more tightly integrate your wallet with LDK you may not need to do this -
3737 // these outputs can just be treated as normal outputs during coin selection.
3838 let pending_spendables_dir =
39- format ! ( "{}/{}" , crate :: PENDING_SPENDABLE_OUTPUT_DIR , ldk_data_dir ) ;
39+ format ! ( "{}/{}" , ldk_data_dir , crate :: PENDING_SPENDABLE_OUTPUT_DIR ) ;
4040 let processing_spendables_dir = format ! ( "{}/processing_spendable_outputs" , ldk_data_dir) ;
4141 let spendables_dir = format ! ( "{}/spendable_outputs" , ldk_data_dir) ;
4242
You can’t perform that action at this time.
0 commit comments