inbound_payments: PaymentInfoStorage, outbound_payments: PaymentInfoStorage,
ldk_data_dir: String, network: Network,
) {
- println!("LDK startup successful. To view available commands: \"help\".");
+ println!(
+ "LDK startup successful. Enter \"help\" to view available commands. Press Ctrl-D to quit."
+ );
println!("LDK logs are available at <your-supplied-ldk-data-dir-path>/.ldk/logs");
println!("Local Node ID is {}.", channel_manager.get_our_node_id());
loop {
break println!("ERROR: {e:#}");
}
+ if line.len() == 0 {
+ // We hit EOF / Ctrl-D
+ break;
+ }
+
let mut words = line.split_whitespace();
if let Some(word) = words.next() {
match word {
Err(e) => println!("ERROR: failed to send onion message: {:?}", e),
}
}
+ "quit" | "exit" => break,
_ => println!("Unknown command. See `\"help\" for available commands."),
}
}
println!("listpeers");
println!("signmessage <message>");
println!("sendonionmessage <node_id_1,node_id_2,..,destination_node_id>");
+ println!("quit")
}
fn node_info(channel_manager: &Arc<ChannelManager>, peer_manager: &Arc<PeerManager>) {
#[tokio::main]
pub async fn main() {
+ #[cfg(not(target_os = "windows"))]
+ {
+ // Catch Ctrl-C with a dummy signal handler.
+ unsafe {
+ let mut new_action: libc::sigaction = core::mem::zeroed();
+ let mut old_action: libc::sigaction = core::mem::zeroed();
+
+ extern "C" fn dummy_handler(
+ _: libc::c_int, _: *const libc::siginfo_t, _: *const libc::c_void,
+ ) {
+ }
+
+ new_action.sa_sigaction = dummy_handler as libc::sighandler_t;
+ new_action.sa_flags = libc::SA_SIGINFO;
+
+ libc::sigaction(
+ libc::SIGINT,
+ &new_action as *const libc::sigaction,
+ &mut old_action as *mut libc::sigaction,
+ );
+ }
+ }
+
start_ldk().await;
}