From 5f4bb593b8f05c3b1149fa9a95ab0da154d84d6b Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 14 Jan 2019 20:37:06 -0500 Subject: [PATCH] Log information about channel freeze/restore from monitor updates --- src/ln/channel.rs | 2 ++ src/ln/channelmanager.rs | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/ln/channel.rs b/src/ln/channel.rs index abe01aa23..beab7ffc6 100644 --- a/src/ln/channel.rs +++ b/src/ln/channel.rs @@ -2373,6 +2373,8 @@ impl Channel { } } + log_trace!(self, "Regenerated latest commitment update with {} update_adds, {} update_fulfills, {} update_fails, and {} update_fail_malformeds", + update_add_htlcs.len(), update_fulfill_htlcs.len(), update_fail_htlcs.len(), update_fail_malformed_htlcs.len()); msgs::CommitmentUpdate { update_add_htlcs, update_fulfill_htlcs, update_fail_htlcs, update_fail_malformed_htlcs, update_fee: None, //TODO: We need to support re-generating any update_fees in the last commitment_signed! diff --git a/src/ln/channelmanager.rs b/src/ln/channelmanager.rs index 6cee5d694..23d5eb21f 100644 --- a/src/ln/channelmanager.rs +++ b/src/ln/channelmanager.rs @@ -457,6 +457,7 @@ macro_rules! handle_monitor_err { ($self: ident, $err: expr, $channel_state: expr, $entry: expr, $action_type: path, $resend_raa: expr, $resend_commitment: expr, $failed_forwards: expr, $failed_fails: expr) => { match $err { ChannelMonitorUpdateErr::PermanentFailure => { + log_error!($self, "Closing channel {} due to monitor update PermanentFailure", log_bytes!($entry.key()[..])); let (channel_id, mut chan) = $entry.remove_entry(); if let Some(short_id) = chan.get_short_channel_id() { $channel_state.short_to_id.remove(&short_id); @@ -474,6 +475,18 @@ macro_rules! handle_monitor_err { res }, ChannelMonitorUpdateErr::TemporaryFailure => { + log_info!($self, "Disabling channel {} due to monitor update TemporaryFailure. On restore will send {} and process {} forwards and {} fails", + log_bytes!($entry.key()[..]), + if $resend_commitment && $resend_raa { + match $action_type { + RAACommitmentOrder::CommitmentFirst => { "commitment then RAA" }, + RAACommitmentOrder::RevokeAndACKFirst => { "RAA then commitment" }, + } + } else if $resend_commitment { "commitment" } + else if $resend_raa { "RAA" } + else { "nothing" }, + (&$failed_forwards as &Vec<(PendingForwardHTLCInfo, u64)>).len(), + (&$failed_fails as &Vec<(HTLCSource, PaymentHash, HTLCFailReason)>).len()); if !$resend_commitment { debug_assert!($action_type == RAACommitmentOrder::RevokeAndACKFirst || !$resend_raa); } -- 2.39.5