Skip to content

Commit e34dab6

Browse files
committed
f improve logging
1 parent 7a91ea9 commit e34dab6

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

lightning/src/ln/channel.rs

+15-6
Original file line numberDiff line numberDiff line change
@@ -3644,6 +3644,10 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
36443644
if release_monitor { self.pending_monitor_updates.last().map(|upd| &upd.update) } else { None }));
36453645
}
36463646

3647+
let release_monitor = self.pending_monitor_updates.iter().all(|upd| !upd.blocked) && !hold_mon_update;
3648+
let release_state_str =
3649+
if hold_mon_update { "Holding" } else if release_monitor { "Releasing" } else { "Blocked" };
3650+
36473651
match self.free_holding_cell_htlcs(logger) {
36483652
(Some(_), htlcs_to_fail) => {
36493653
let mut additional_update = self.pending_monitor_updates.pop().unwrap().update;
@@ -3652,8 +3656,10 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
36523656
self.latest_monitor_update_id = monitor_update.update_id;
36533657
monitor_update.updates.append(&mut additional_update.updates);
36543658

3659+
log_debug!(logger, "Received a valid revoke_and_ack for channel {} with holding cell HTLCs freed. {} monitor update.",
3660+
log_bytes!(self.channel_id()), release_state_str);
3661+
36553662
self.monitor_updating_paused(false, true, false, to_forward_infos, revoked_htlcs, finalized_claimed_htlcs);
3656-
let release_monitor = self.pending_monitor_updates.iter().all(|upd| !upd.blocked) && !hold_mon_update;
36573663
self.pending_monitor_updates.push(PendingChannelMonitorUpdate {
36583664
update: monitor_update, blocked: !release_monitor,
36593665
});
@@ -3669,19 +3675,22 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
36693675
self.latest_monitor_update_id = monitor_update.update_id;
36703676
monitor_update.updates.append(&mut additional_update.updates);
36713677

3672-
log_debug!(logger, "Received a valid revoke_and_ack for channel {}. Responding with a commitment update with {} HTLCs failed.",
3673-
log_bytes!(self.channel_id()), update_fail_htlcs.len() + update_fail_malformed_htlcs.len());
3678+
log_debug!(logger, "Received a valid revoke_and_ack for channel {}. Responding with a commitment update with {} HTLCs failed. {} monitor update.",
3679+
log_bytes!(self.channel_id()),
3680+
update_fail_htlcs.len() + update_fail_malformed_htlcs.len(),
3681+
release_state_str);
3682+
36743683
self.monitor_updating_paused(false, true, false, to_forward_infos, revoked_htlcs, finalized_claimed_htlcs);
3675-
let release_monitor = self.pending_monitor_updates.iter().all(|upd| !upd.blocked) && !hold_mon_update;
36763684
self.pending_monitor_updates.push(PendingChannelMonitorUpdate {
36773685
update: monitor_update, blocked: !release_monitor,
36783686
});
36793687
Ok((htlcs_to_fail,
36803688
if release_monitor { self.pending_monitor_updates.last().map(|upd| &upd.update) } else { None }))
36813689
} else {
3682-
log_debug!(logger, "Received a valid revoke_and_ack for channel {} with no reply necessary.", log_bytes!(self.channel_id()));
3690+
log_debug!(logger, "Received a valid revoke_and_ack for channel {} with no reply necessary. {} monitor update.",
3691+
log_bytes!(self.channel_id()), release_state_str);
3692+
36833693
self.monitor_updating_paused(false, false, false, to_forward_infos, revoked_htlcs, finalized_claimed_htlcs);
3684-
let release_monitor = self.pending_monitor_updates.iter().all(|upd| !upd.blocked) && !hold_mon_update;
36853694
self.pending_monitor_updates.push(PendingChannelMonitorUpdate {
36863695
update: monitor_update, blocked: !release_monitor,
36873696
});

0 commit comments

Comments
 (0)