Skip to content

Commit d4a82b5

Browse files
committed
Log info about HTLC failures when we fail them back
1 parent 8dada0c commit d4a82b5

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
@@ -1329,7 +1329,7 @@ impl<Signer: Sign> Channel<Signer> {
13291329
///
13301330
/// Note that it is still possible to hit these assertions in case we find a preimage on-chain
13311331
/// but then have a reorg which settles on an HTLC-failure on chain.
1332-
pub fn get_update_fail_htlc(&mut self, htlc_id_arg: u64, err_packet: msgs::OnionErrorPacket) -> Result<Option<msgs::UpdateFailHTLC>, ChannelError> {
1332+
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 {
13331333
if (self.channel_state & (ChannelState::ChannelFunded as u32)) != (ChannelState::ChannelFunded as u32) {
13341334
panic!("Was asked to fail an HTLC when channel was not in an operational state");
13351335
}
@@ -1379,13 +1379,15 @@ impl<Signer: Sign> Channel<Signer> {
13791379
_ => {}
13801380
}
13811381
}
1382+
log_trace!(logger, "Placing failure for HTLC ID {} in holding cell", htlc_id_arg);
13821383
self.holding_cell_htlc_updates.push(HTLCUpdateAwaitingACK::FailHTLC {
13831384
htlc_id: htlc_id_arg,
13841385
err_packet,
13851386
});
13861387
return Ok(None);
13871388
}
13881389

1390+
log_trace!(logger, "Failure HTLC ID {} back with a update_fail_htlc message", htlc_id_arg);
13891391
{
13901392
let htlc = &mut self.pending_inbound_htlcs[pending_idx];
13911393
htlc.state = InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::FailRelay(err_packet.clone()));
@@ -2377,7 +2379,7 @@ impl<Signer: Sign> Channel<Signer> {
23772379
}
23782380
},
23792381
&HTLCUpdateAwaitingACK::FailHTLC { htlc_id, ref err_packet } => {
2380-
match self.get_update_fail_htlc(htlc_id, err_packet.clone()) {
2382+
match self.get_update_fail_htlc(htlc_id, err_packet.clone(), logger) {
23812383
Ok(update_fail_msg_option) => update_fail_htlcs.push(update_fail_msg_option.unwrap()),
23822384
Err(e) => {
23832385
if let ChannelError::Ignore(_) = e {}

lightning/src/ln/channelmanager.rs

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

0 commit comments

Comments
 (0)