Skip to content

Commit 7124124

Browse files
committed
Log info about HTLC failures when we fail them back
1 parent 3933f8e commit 7124124

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
@@ -1318,7 +1318,7 @@ impl<Signer: Sign> Channel<Signer> {
13181318
///
13191319
/// Note that it is still possible to hit these assertions in case we find a preimage on-chain
13201320
/// but then have a reorg which settles on an HTLC-failure on chain.
1321-
pub fn get_update_fail_htlc(&mut self, htlc_id_arg: u64, err_packet: msgs::OnionErrorPacket) -> Result<Option<msgs::UpdateFailHTLC>, ChannelError> {
1321+
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 {
13221322
if (self.channel_state & (ChannelState::ChannelFunded as u32)) != (ChannelState::ChannelFunded as u32) {
13231323
panic!("Was asked to fail an HTLC when channel was not in an operational state");
13241324
}
@@ -1368,13 +1368,15 @@ impl<Signer: Sign> Channel<Signer> {
13681368
_ => {}
13691369
}
13701370
}
1371+
log_trace!(logger, "Placing failure for HTLC ID {} in holding cell", htlc_id_arg);
13711372
self.holding_cell_htlc_updates.push(HTLCUpdateAwaitingACK::FailHTLC {
13721373
htlc_id: htlc_id_arg,
13731374
err_packet,
13741375
});
13751376
return Ok(None);
13761377
}
13771378

1379+
log_trace!(logger, "Failure HTLC ID {} back with a update_fail_htlc message", htlc_id_arg);
13781380
{
13791381
let htlc = &mut self.pending_inbound_htlcs[pending_idx];
13801382
htlc.state = InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::FailRelay(err_packet.clone()));
@@ -2366,7 +2368,7 @@ impl<Signer: Sign> Channel<Signer> {
23662368
}
23672369
},
23682370
&HTLCUpdateAwaitingACK::FailHTLC { htlc_id, ref err_packet } => {
2369-
match self.get_update_fail_htlc(htlc_id, err_packet.clone()) {
2371+
match self.get_update_fail_htlc(htlc_id, err_packet.clone(), logger) {
23702372
Ok(update_fail_msg_option) => update_fail_htlcs.push(update_fail_msg_option.unwrap()),
23712373
Err(e) => {
23722374
if let ChannelError::Ignore(_) = e {}

lightning/src/ln/channelmanager.rs

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

0 commit comments

Comments
 (0)