Skip to content

Commit a33a1bc

Browse files
committed
Improve logging around redundant force close monitor updates
1 parent 9878ede commit a33a1bc

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,8 +2339,16 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
23392339
F::Target: FeeEstimator,
23402340
L::Target: Logger,
23412341
{
2342-
log_info!(logger, "Applying update to monitor {}, bringing update_id from {} to {} with {} changes.",
2343-
log_funding_info!(self), self.latest_update_id, updates.update_id, updates.updates.len());
2342+
if self.latest_update_id == CLOSED_CHANNEL_UPDATE_ID && updates.update_id == CLOSED_CHANNEL_UPDATE_ID {
2343+
log_info!(logger, "Applying post-force-closed update to monitor {} with {} change(s).",
2344+
log_funding_info!(self), updates.updates.len());
2345+
} else if updates.update_id == CLOSED_CHANNEL_UPDATE_ID {
2346+
log_info!(logger, "Applying force close update to monitor {} with {} change(s).",
2347+
log_funding_info!(self), updates.updates.len());
2348+
} else {
2349+
log_info!(logger, "Applying update to monitor {}, bringing update_id from {} to {} with {} change(s).",
2350+
log_funding_info!(self), self.latest_update_id, updates.update_id, updates.updates.len());
2351+
}
23442352
// ChannelMonitor updates may be applied after force close if we receive a preimage for a
23452353
// broadcasted commitment transaction HTLC output that we'd like to claim on-chain. If this
23462354
// is the case, we no longer have guaranteed access to the monitor's update ID, so we use a
@@ -2407,6 +2415,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
24072415
_ => false,
24082416
}).is_some();
24092417
if detected_funding_spend {
2418+
log_trace!(logger, "Avoiding commitment broadcast, already detected confirmed spend onchain");
24102419
continue;
24112420
}
24122421
self.broadcast_latest_holder_commitment_txn(broadcaster, logger);

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7756,6 +7756,8 @@ where
77567756

77577757
for (funding_txo, _) in args.channel_monitors.iter() {
77587758
if !funding_txo_set.contains(funding_txo) {
7759+
log_info!(args.logger, "Force closing missing channel {}, note it may have been closed already",
7760+
log_bytes!(funding_txo.to_channel_id()));
77597761
let monitor_update = ChannelMonitorUpdate {
77607762
update_id: CLOSED_CHANNEL_UPDATE_ID,
77617763
updates: vec![ChannelMonitorUpdateStep::ChannelForceClosed { should_broadcast: true }],

0 commit comments

Comments
 (0)