]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Set logging metadata when we fail to apply a `ChannelMonitorUpdate`
authorMatt Corallo <git@bluematt.me>
Fri, 1 Dec 2023 21:56:43 +0000 (21:56 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 12 Dec 2023 02:08:36 +0000 (02:08 +0000)
Now that we provide the counterparty node id, we can set logging
metadata with a counterparty node id and and channel id, which we
do here.

lightning/src/chain/chainmonitor.rs

index 09a32b6e2145e79a16121819f3112a31335ae5ca..14544754318ad5945622c42bd0300679aef6a6de 100644 (file)
@@ -35,7 +35,7 @@ use crate::sign::ecdsa::WriteableEcdsaChannelSigner;
 use crate::events;
 use crate::events::{Event, EventHandler};
 use crate::util::atomic_counter::AtomicCounter;
-use crate::util::logger::Logger;
+use crate::util::logger::{Logger, WithContext};
 use crate::util::errors::APIError;
 use crate::util::wakers::{Future, Notifier};
 use crate::ln::channelmanager::ChannelDetails;
@@ -757,7 +757,8 @@ where C::Target: chain::Filter,
                let monitors = self.monitors.read().unwrap();
                match monitors.get(&funding_txo) {
                        None => {
-                               log_error!(self.logger, "Failed to update channel monitor: no such monitor registered");
+                               let logger = WithContext::from(&self.logger, update.counterparty_node_id, Some(funding_txo.to_channel_id()));
+                               log_error!(logger, "Failed to update channel monitor: no such monitor registered");
 
                                // We should never ever trigger this from within ChannelManager. Technically a
                                // user could use this object with some proxying in between which makes this