Skip to content

Commit 66787cf

Browse files
committed
Log info about HTLC failures when we fail them back
1 parent 1bf22cf commit 66787cf

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lightning/src/ln/channel.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@ impl<Signer: Sign> Channel<Signer> {
13321332
///
13331333
/// Note that it is still possible to hit these assertions in case we find a preimage on-chain
13341334
/// but then have a reorg which settles on an HTLC-failure on chain.
1335-
pub fn get_update_fail_htlc(&mut self, htlc_id_arg: u64, err_packet: msgs::OnionErrorPacket) -> Result<Option<msgs::UpdateFailHTLC>, ChannelError> {
1335+
pub fn get_update_fail_htlc<L: Deref>(&mut self, htlc_id_arg: u64, err_packet: msgs::OnionErrorPacket, logger: &L) -> Result<Option<msgs::UpdateFailHTLC>, ChannelError> where L::Target: Logger {
13361336
if (self.channel_state & (ChannelState::ChannelFunded as u32)) != (ChannelState::ChannelFunded as u32) {
13371337
panic!("Was asked to fail an HTLC when channel was not in an operational state");
13381338
}
@@ -1382,13 +1382,15 @@ impl<Signer: Sign> Channel<Signer> {
13821382
_ => {}
13831383
}
13841384
}
1385+
log_trace!(logger, "Placing failure for HTLC ID {} in holding cell", htlc_id_arg);
13851386
self.holding_cell_htlc_updates.push(HTLCUpdateAwaitingACK::FailHTLC {
13861387
htlc_id: htlc_id_arg,
13871388
err_packet,
13881389
});
13891390
return Ok(None);
13901391
}
13911392

1393+
log_trace!(logger, "Failing HTLC ID {} back with a update_fail_htlc message", htlc_id_arg);
13921394
{
13931395
let htlc = &mut self.pending_inbound_htlcs[pending_idx];
13941396
htlc.state = InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::FailRelay(err_packet.clone()));
@@ -2382,7 +2384,7 @@ impl<Signer: Sign> Channel<Signer> {
23822384
}
23832385
},
23842386
&HTLCUpdateAwaitingACK::FailHTLC { htlc_id, ref err_packet } => {
2385-
match self.get_update_fail_htlc(htlc_id, err_packet.clone()) {
2387+
match self.get_update_fail_htlc(htlc_id, err_packet.clone(), logger) {
23862388
Ok(update_fail_msg_option) => update_fail_htlcs.push(update_fail_msg_option.unwrap()),
23872389
Err(e) => {
23882390
if let ChannelError::Ignore(_) = e {}

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2069,7 +2069,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
20692069
},
20702070
HTLCForwardInfo::FailHTLC { htlc_id, err_packet } => {
20712071
log_trace!(self.logger, "Failing HTLC back to channel with short id {} after delay", short_chan_id);
2072-
match chan.get_mut().get_update_fail_htlc(htlc_id, err_packet) {
2072+
match chan.get_mut().get_update_fail_htlc(htlc_id, err_packet, &self.logger) {
20732073
Err(e) => {
20742074
if let ChannelError::Ignore(msg) = e {
20752075
log_trace!(self.logger, "Failed to fail backwards to short_id {}: {}", short_chan_id, msg);

0 commit comments

Comments
 (0)