Update to v0.0.110
[ldk-sample] / src / main.rs
index bfe5bff311517794daa5f7a0207e34955a49af3f..1fddf8b91b3226074560f88132c089f4c737eae0 100644 (file)
@@ -30,7 +30,7 @@ use lightning::routing::scoring::ProbabilisticScorer;
 use lightning::util::config::UserConfig;
 use lightning::util::events::{Event, PaymentPurpose};
 use lightning::util::ser::ReadableArgs;
-use lightning_background_processor::BackgroundProcessor;
+use lightning_background_processor::{BackgroundProcessor, GossipSync};
 use lightning_block_sync::init;
 use lightning_block_sync::poll;
 use lightning_block_sync::SpvClient;
@@ -39,7 +39,6 @@ use lightning_invoice::payment;
 use lightning_invoice::utils::DefaultRouter;
 use lightning_net_tokio::SocketDescriptor;
 use lightning_persister::FilesystemPersister;
-use lightning_rapid_gossip_sync::RapidGossipSync;
 use rand::{thread_rng, Rng};
 use std::collections::hash_map::Entry;
 use std::collections::HashMap;
@@ -111,9 +110,6 @@ pub(crate) type InvoicePayer<E> = payment::InvoicePayer<
 
 type Router = DefaultRouter<Arc<NetworkGraph>, Arc<FilesystemLogger>>;
 
-type GossipSync<P, G, A, L> =
-       lightning_background_processor::GossipSync<P, Arc<RapidGossipSync<G, L>>, G, A, L>;
-
 pub(crate) type NetworkGraph = gossip::NetworkGraph<Arc<FilesystemLogger>>;
 
 async fn handle_ldk_events(
@@ -245,6 +241,8 @@ async fn handle_ldk_events(
                }
                Event::PaymentPathSuccessful { .. } => {}
                Event::PaymentPathFailed { .. } => {}
+               Event::ProbeSuccessful { .. } => {}
+               Event::ProbeFailed { .. } => {}
                Event::PaymentFailed { payment_hash, .. } => {
                        print!(
                                "\nEVENT: Failed to send payment to payment hash {:?}: exhausted payment retry attempts",
@@ -275,11 +273,11 @@ async fn handle_ldk_events(
                                        None => String::new(),
                                        Some(channel) => {
                                                match nodes.get(&NodeId::from_pubkey(&channel.counterparty.node_id)) {
-                                                       None => " from private node".to_string(),
+                                                       None => "private node".to_string(),
                                                        Some(node) => match &node.announcement_info {
-                                                               None => " from unnamed node".to_string(),
+                                                               None => "unnamed node".to_string(),
                                                                Some(announcement) => {
-                                                                       format!(" from node {}", announcement.alias)
+                                                                       format!("node {}", announcement.alias)
                                                                }
                                                        },
                                                }
@@ -292,9 +290,9 @@ async fn handle_ldk_events(
                                        .unwrap_or_default()
                        };
                        let from_prev_str =
-                               format!("{}{}", node_str(prev_channel_id), channel_str(prev_channel_id));
+                               format!(" from {}{}", node_str(prev_channel_id), channel_str(prev_channel_id));
                        let to_next_str =
-                               format!("{}{}", node_str(next_channel_id), channel_str(next_channel_id));
+                               format!(" to {}{}", node_str(next_channel_id), channel_str(next_channel_id));
 
                        let from_onchain_str = if *claim_from_onchain_tx {
                                "from onchain downstream claim"
@@ -315,6 +313,7 @@ async fn handle_ldk_events(
                        print!("> ");
                        io::stdout().flush().unwrap();
                }
+               Event::HTLCHandlingFailed { .. } => {}
                Event::PendingHTLCsForwardable { time_forwardable } => {
                        let forwarding_channel_manager = channel_manager.clone();
                        let min = time_forwardable.as_millis() as u64;
@@ -674,7 +673,7 @@ async fn start_ldk() {
                invoice_payer.clone(),
                chain_monitor.clone(),
                channel_manager.clone(),
-               GossipSync::P2P(gossip_sync.clone()),
+               GossipSync::p2p(gossip_sync.clone()),
                peer_manager.clone(),
                logger.clone(),
                Some(scorer.clone()),