use lightning_invoice::{utils, Currency, Invoice};
use std::env;
use std::io;
-use std::io::{BufRead, Write};
+use std::io::Write;
use std::net::{IpAddr, SocketAddr, ToSocketAddrs};
use std::ops::Deref;
use std::path::Path;
println!("LDK startup successful. To view available commands: \"help\".");
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());
- let stdin = io::stdin();
- let mut line_reader = stdin.lock().lines();
loop {
print!("> ");
io::stdout().flush().unwrap(); // Without flushing, the `>` doesn't print
- let line = match line_reader.next() {
- Some(l) => l.unwrap(),
- None => break,
- };
+ let mut line = String::new();
+ if let Err(e) = io::stdin().read_line(&mut line) {
+ break println!("ERROR: {e:#}");
+ }
+
let mut words = line.split_whitespace();
if let Some(word) = words.next() {
match word {
let mut cache = UnboundedCache::new();
let mut chain_tip: Option<poll::ValidatedBlockHeader> = None;
if restarting_node {
- let mut chain_listeners =
- vec![(channel_manager_blockhash, &channel_manager as &dyn chain::Listen)];
+ let mut chain_listeners = vec![(
+ channel_manager_blockhash,
+ &channel_manager as &(dyn chain::Listen + Send + Sync),
+ )];
for (blockhash, channel_monitor) in channelmonitors.drain(..) {
let outpoint = channel_monitor.get_funding_txo().0;
}
for monitor_listener_info in chain_listener_channel_monitors.iter_mut() {
- chain_listeners
- .push((monitor_listener_info.0, &monitor_listener_info.1 as &dyn chain::Listen));
+ chain_listeners.push((
+ monitor_listener_info.0,
+ &monitor_listener_info.1 as &(dyn chain::Listen + Send + Sync),
+ ));
}
chain_tip = Some(
init::synchronize_listeners(