Skip to content

Commit 569f172

Browse files
f - temporarily lock short_to_chan_info before pending_outbound_payments
1 parent a3afe59 commit 569f172

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2447,6 +2447,11 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
24472447
let err: Result<(), _> = loop {
24482448
let mut channel_lock = self.channel_state.lock().unwrap();
24492449

2450+
let id = match self.short_to_chan_info.read().unwrap().get(&path.first().unwrap().short_channel_id) {
2451+
None => return Err(APIError::ChannelUnavailable{err: "No channel available with first hop!".to_owned()}),
2452+
Some((_cp_id, chan_id)) => chan_id.clone(),
2453+
};
2454+
24502455
let mut pending_outbounds = self.pending_outbound_payments.lock().unwrap();
24512456
let payment_entry = pending_outbounds.entry(payment_id);
24522457
if let hash_map::Entry::Occupied(payment) = &payment_entry {
@@ -2457,11 +2462,6 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
24572462
}
24582463
}
24592464

2460-
let id = match self.short_to_chan_info.read().unwrap().get(&path.first().unwrap().short_channel_id) {
2461-
None => return Err(APIError::ChannelUnavailable{err: "No channel available with first hop!".to_owned()}),
2462-
Some((_cp_id, chan_id)) => chan_id.clone(),
2463-
};
2464-
24652465
macro_rules! insert_outbound_payment {
24662466
() => {
24672467
let payment = payment_entry.or_insert_with(|| PendingOutboundPayment::Retryable {

0 commit comments

Comments
 (0)