Skip to content

Commit 5f4bb59

Browse files
committed
Log information about channel freeze/restore from monitor updates
1 parent e5fa4f2 commit 5f4bb59

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/ln/channel.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2373,6 +2373,8 @@ impl Channel {
23732373
}
23742374
}
23752375

2376+
log_trace!(self, "Regenerated latest commitment update with {} update_adds, {} update_fulfills, {} update_fails, and {} update_fail_malformeds",
2377+
update_add_htlcs.len(), update_fulfill_htlcs.len(), update_fail_htlcs.len(), update_fail_malformed_htlcs.len());
23762378
msgs::CommitmentUpdate {
23772379
update_add_htlcs, update_fulfill_htlcs, update_fail_htlcs, update_fail_malformed_htlcs,
23782380
update_fee: None, //TODO: We need to support re-generating any update_fees in the last commitment_signed!

src/ln/channelmanager.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ macro_rules! handle_monitor_err {
457457
($self: ident, $err: expr, $channel_state: expr, $entry: expr, $action_type: path, $resend_raa: expr, $resend_commitment: expr, $failed_forwards: expr, $failed_fails: expr) => {
458458
match $err {
459459
ChannelMonitorUpdateErr::PermanentFailure => {
460+
log_error!($self, "Closing channel {} due to monitor update PermanentFailure", log_bytes!($entry.key()[..]));
460461
let (channel_id, mut chan) = $entry.remove_entry();
461462
if let Some(short_id) = chan.get_short_channel_id() {
462463
$channel_state.short_to_id.remove(&short_id);
@@ -474,6 +475,18 @@ macro_rules! handle_monitor_err {
474475
res
475476
},
476477
ChannelMonitorUpdateErr::TemporaryFailure => {
478+
log_info!($self, "Disabling channel {} due to monitor update TemporaryFailure. On restore will send {} and process {} forwards and {} fails",
479+
log_bytes!($entry.key()[..]),
480+
if $resend_commitment && $resend_raa {
481+
match $action_type {
482+
RAACommitmentOrder::CommitmentFirst => { "commitment then RAA" },
483+
RAACommitmentOrder::RevokeAndACKFirst => { "RAA then commitment" },
484+
}
485+
} else if $resend_commitment { "commitment" }
486+
else if $resend_raa { "RAA" }
487+
else { "nothing" },
488+
(&$failed_forwards as &Vec<(PendingForwardHTLCInfo, u64)>).len(),
489+
(&$failed_fails as &Vec<(HTLCSource, PaymentHash, HTLCFailReason)>).len());
477490
if !$resend_commitment {
478491
debug_assert!($action_type == RAACommitmentOrder::RevokeAndACKFirst || !$resend_raa);
479492
}

0 commit comments

Comments
 (0)