]> git.bitcoin.ninja Git - ldk-sample/commitdiff
Correct logging on forwarded HTLCs
authorMatt Corallo <git@bluematt.me>
Sat, 16 Jul 2022 15:48:39 +0000 (15:48 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 16 Jul 2022 15:50:29 +0000 (15:50 +0000)
Instead of "forwarded from A from B" it should read "forwarded
from A to B".

src/main.rs

index bfe5bff311517794daa5f7a0207e34955a49af3f..08bedc70c1b0d4adc3b4bae3ead8def147eb6928 100644 (file)
@@ -275,11 +275,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 +292,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"