]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Move the channel_announcement process log into `NetworkGraph` 2023-01-async-utxo-lookups
authorMatt Corallo <git@bluematt.me>
Thu, 26 Jan 2023 03:04:14 +0000 (03:04 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 9 Feb 2023 15:40:44 +0000 (15:40 +0000)
This ensures its always written after we update the graph, no
matter how we updated the graph.

lightning/src/routing/gossip.rs

index 13c8f09a377d377681cee72c3409bb85a94a4362..a499532e6a94a8c46016afb3d367ceab4461f633 100644 (file)
@@ -381,7 +381,6 @@ where U::Target: UtxoLookup, L::Target: Logger
 
        fn handle_channel_announcement(&self, msg: &msgs::ChannelAnnouncement) -> Result<bool, LightningError> {
                self.network_graph.update_channel_from_announcement(msg, &self.utxo_lookup)?;
-               log_gossip!(self.logger, "Added channel_announcement for {}{}", msg.contents.short_channel_id, if !msg.contents.excess_data.is_empty() { " with excess uninterpreted data!" } else { "" });
                Ok(msg.contents.excess_data.len() <= MAX_EXCESS_BYTES_FOR_RELAY)
        }
 
@@ -1559,7 +1558,10 @@ impl<L: Deref> NetworkGraph<L> where L::Target: Logger {
                        announcement_received_time,
                };
 
-               self.add_channel_between_nodes(msg.short_channel_id, chan_info, utxo_value)
+               self.add_channel_between_nodes(msg.short_channel_id, chan_info, utxo_value)?;
+
+               log_gossip!(self.logger, "Added channel_announcement for {}{}", msg.short_channel_id, if !msg.excess_data.is_empty() { " with excess uninterpreted data!" } else { "" });
+               Ok(())
        }
 
        /// Marks a channel in the graph as failed if a corresponding HTLC fail was sent.