Skip to content

Commit

Permalink
Send PaymentForwardedFailed if no forwardable HTLC
Browse files Browse the repository at this point in the history
  • Loading branch information
jurvis committed Apr 7, 2022
1 parent 97dcedb commit 33ed8fc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lightning/src/ln/channelmanager.rs
Expand Up @@ -3982,7 +3982,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
pending_events.push(path_failure);
if let Some(ev) = full_failure_ev { pending_events.push(ev); }
},
HTLCSource::PreviousHopData(HTLCPreviousHopData { short_channel_id, htlc_id, incoming_packet_shared_secret, phantom_shared_secret, .. }) => {
HTLCSource::PreviousHopData(HTLCPreviousHopData { short_channel_id, htlc_id, incoming_packet_shared_secret, phantom_shared_secret, outpoint }) => {
let err_packet = match onion_error {
HTLCFailReason::Reason { failure_code, data } => {
log_trace!(self.logger, "Failing HTLC with payment_hash {} backwards from us with code {}", log_bytes!(payment_hash.0), failure_code);
Expand Down Expand Up @@ -4020,6 +4020,11 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
time_forwardable: time
});
}

let mut pending_events = self.pending_events.lock().unwrap();
pending_events.push(events::Event::PaymentForwardedFailed {
source_channel_id: outpoint.to_channel_id() , sink_node_id: self.get_our_node_id()
});
},
}
}
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/util/events.rs
Expand Up @@ -448,7 +448,7 @@ pub enum Event {
/// Indicates that a payment has failed to be forwarded through us
PaymentForwardedFailed {
/// The channel_id of the sender
source_channel_id: u64,
source_channel_id: [u8; 32],
/// The node_id of the receiver where forwarding has failed
sink_node_id: PublicKey
},
Expand Down

0 comments on commit 33ed8fc

Please sign in to comment.