Skip to content

Commit 48bfe9a

Browse files
committed
f only one push
1 parent f45c8c8 commit 48bfe9a

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3350,7 +3350,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
33503350
} else { None };
33513351
log_trace!(self.logger, "Failing outbound payment HTLC with payment_hash {}", log_bytes!(payment_hash.0));
33523352

3353-
match &onion_error {
3353+
let path_failure = match &onion_error {
33543354
&HTLCFailReason::LightningError { ref err } => {
33553355
#[cfg(test)]
33563356
let (network_update, short_channel_id, payment_retryable, onion_error_code, onion_error_data) = onion_utils::process_onion_failure(&self.secp_ctx, &self.logger, &source, err.data.clone());
@@ -3359,8 +3359,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
33593359
// TODO: If we decided to blame ourselves (or one of our channels) in
33603360
// process_onion_failure we should close that channel as it implies our
33613361
// next-hop is needlessly blaming us!
3362-
let mut pending_events = self.pending_events.lock().unwrap();
3363-
pending_events.push(events::Event::PaymentPathFailed {
3362+
events::Event::PaymentPathFailed {
33643363
payment_id: Some(payment_id),
33653364
payment_hash: payment_hash.clone(),
33663365
rejected_by_dest: !payment_retryable,
@@ -3373,8 +3372,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
33733372
error_code: onion_error_code,
33743373
#[cfg(test)]
33753374
error_data: onion_error_data
3376-
});
3377-
if let Some(ev) = full_failure_ev { pending_events.push(ev); }
3375+
}
33783376
},
33793377
&HTLCFailReason::Reason {
33803378
#[cfg(test)]
@@ -3389,8 +3387,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
33893387
// ChannelDetails.
33903388
// TODO: For non-temporary failures, we really should be closing the
33913389
// channel here as we apparently can't relay through them anyway.
3392-
let mut pending_events = self.pending_events.lock().unwrap();
3393-
pending_events.push(events::Event::PaymentPathFailed {
3390+
events::Event::PaymentPathFailed {
33943391
payment_id: Some(payment_id),
33953392
payment_hash: payment_hash.clone(),
33963393
rejected_by_dest: path.len() == 1,
@@ -3403,10 +3400,12 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
34033400
error_code: Some(*failure_code),
34043401
#[cfg(test)]
34053402
error_data: Some(data.clone()),
3406-
});
3407-
if let Some(ev) = full_failure_ev { pending_events.push(ev); }
3403+
}
34083404
}
3409-
}
3405+
};
3406+
let mut pending_events = self.pending_events.lock().unwrap();
3407+
pending_events.push(path_failure);
3408+
if let Some(ev) = full_failure_ev { pending_events.push(ev); }
34103409
},
34113410
HTLCSource::PreviousHopData(HTLCPreviousHopData { short_channel_id, htlc_id, incoming_packet_shared_secret, .. }) => {
34123411
let err_packet = match onion_error {

0 commit comments

Comments
 (0)