Skip to content

Commit 2d0a8d5

Browse files
committed
Log when we change HTLC state while sending a commitment transaction
1 parent e59c26a commit 2d0a8d5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lightning/src/ln/channel.rs

+4
Original file line numberDiff line numberDiff line change
@@ -4462,6 +4462,7 @@ impl<Signer: Sign> Channel<Signer> {
44624462
}
44634463
/// Only fails in case of bad keys
44644464
fn send_commitment_no_status_check<L: Deref>(&mut self, logger: &L) -> Result<(msgs::CommitmentSigned, ChannelMonitorUpdate), ChannelError> where L::Target: Logger {
4465+
log_trace!(logger, "Updating HTLC state for a newly-sent commitment_signed...");
44654466
// We can upgrade the status of some HTLCs that are waiting on a commitment, even if we
44664467
// fail to generate this, we still are at least at a position where upgrading their status
44674468
// is acceptable.
@@ -4470,19 +4471,22 @@ impl<Signer: Sign> Channel<Signer> {
44704471
Some(InboundHTLCState::AwaitingAnnouncedRemoteRevoke(forward_info.clone()))
44714472
} else { None };
44724473
if let Some(state) = new_state {
4474+
log_trace!(logger, " ...promoting inbound AwaitingRemoteRevokeToAnnounce {} to AwaitingAnnouncedRemoteRevoke", log_bytes!(htlc.payment_hash.0));
44734475
htlc.state = state;
44744476
}
44754477
}
44764478
for htlc in self.pending_outbound_htlcs.iter_mut() {
44774479
if let Some(fail_reason) = if let &mut OutboundHTLCState::AwaitingRemoteRevokeToRemove(ref mut fail_reason) = &mut htlc.state {
44784480
Some(fail_reason.take())
44794481
} else { None } {
4482+
log_trace!(logger, " ...promoting outbound AwaitingRemoteRevokeToRemove {} to AwaitingRemovedRemoteRevoke", log_bytes!(htlc.payment_hash.0));
44804483
htlc.state = OutboundHTLCState::AwaitingRemovedRemoteRevoke(fail_reason);
44814484
}
44824485
}
44834486
if let Some((feerate, update_state)) = self.pending_update_fee {
44844487
if update_state == FeeUpdateState::AwaitingRemoteRevokeToAnnounce {
44854488
debug_assert!(!self.is_outbound());
4489+
log_trace!(logger, " ...promoting inbound AwaitingRemoteRevokeToAnnounce fee update {} to Committed", feerate);
44864490
self.feerate_per_kw = feerate;
44874491
self.pending_update_fee = None;
44884492
}

0 commit comments

Comments
 (0)