From ebffd47c9bfdf847679e041eb9107120b3740d38 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 26 Jan 2023 03:04:14 +0000 Subject: [PATCH] Move the channel_announcement process log into `NetworkGraph` This ensures its always written after we update the graph, no matter how we updated the graph. --- lightning/src/routing/gossip.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lightning/src/routing/gossip.rs b/lightning/src/routing/gossip.rs index bf4fcae36fe..f86d6860b59 100644 --- a/lightning/src/routing/gossip.rs +++ b/lightning/src/routing/gossip.rs @@ -361,7 +361,6 @@ where C::Target: ChainAccess, L::Target: Logger fn handle_channel_announcement(&self, msg: &msgs::ChannelAnnouncement) -> Result { self.network_graph.update_channel_from_announcement(msg, &self.chain_access)?; - 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) } @@ -1543,7 +1542,10 @@ impl NetworkGraph 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.