Log information about channel freeze/restore from monitor updates 2019-01-log-more
authorMatt Corallo <git@bluematt.me>
Tue, 15 Jan 2019 01:37:06 +0000 (20:37 -0500)
committerMatt Corallo <git@bluematt.me>
Fri, 25 Jan 2019 17:04:39 +0000 (12:04 -0500)
src/ln/channel.rs
src/ln/channelmanager.rs

index abe01aa23dd772c30dd8a3271ef377e6a1d3637b..beab7ffc6da7808e4caa553d4d012621a8dda8ba 100644 (file)
@@ -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!
index 6cee5d6941792a05d365ea8ee36b790e73d980f2..23d5eb21f75269fed9270c8c33913db9453b0d3c 100644 (file)
@@ -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);
                                }