Skip to content

Commit

Permalink
Rename parameter from err_packet to err_contents.
Browse files Browse the repository at this point in the history
This name is more accurate since the method has been generalized to support
malformed HTLCs.
  • Loading branch information
valentinewallace committed Jan 10, 2024
1 parent c1fbb90 commit 3ec4d52
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lightning/src/ln/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2899,7 +2899,7 @@ impl<SP: Deref> Channel<SP> where
/// return `Ok(_)` if preconditions are met. In any case, `Err`s will only be
/// [`ChannelError::Ignore`].
fn fail_htlc<L: Deref, E: FailHTLCContents + Clone>(
&mut self, htlc_id_arg: u64, err_packet: E, mut force_holding_cell: bool,
&mut self, htlc_id_arg: u64, err_contents: E, mut force_holding_cell: bool,
logger: &L
) -> Result<Option<E::Message>, ChannelError> where L::Target: Logger {
if !matches!(self.context.channel_state, ChannelState::ChannelReady(_)) {
Expand Down Expand Up @@ -2966,18 +2966,18 @@ impl<SP: Deref> Channel<SP> where
}
}
log_trace!(logger, "Placing failure for HTLC ID {} in holding cell in channel {}.", htlc_id_arg, &self.context.channel_id());
self.context.holding_cell_htlc_updates.push(err_packet.to_htlc_update_awaiting_ack(htlc_id_arg));
self.context.holding_cell_htlc_updates.push(err_contents.to_htlc_update_awaiting_ack(htlc_id_arg));
return Ok(None);
}

log_trace!(logger, "Failing HTLC ID {} back with {} message in channel {}.", htlc_id_arg,
E::Message::name(), &self.context.channel_id());
{
let htlc = &mut self.context.pending_inbound_htlcs[pending_idx];
htlc.state = err_packet.clone().to_inbound_htlc_state();
htlc.state = err_contents.clone().to_inbound_htlc_state();
}

Ok(Some(err_packet.to_message(htlc_id_arg, self.context.channel_id())))
Ok(Some(err_contents.to_message(htlc_id_arg, self.context.channel_id())))
}

// Message handlers:
Expand Down

0 comments on commit 3ec4d52

Please sign in to comment.