Skip to content

Commit 13dbfe3

Browse files
f - cleanup channel selection order
1 parent 6b9a261 commit 13dbfe3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3129,10 +3129,11 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
31293129
// Attempt to forward the HTLC over all available channels
31303130
// to the peer, but attempt to forward the HTLC over the
31313131
// channel specified in the onion payload first.
3132-
let mut counterparty_channel_ids = peer_state.channel_by_id.keys()
3133-
.filter(|chan_id| **chan_id != forward_chan_id)
3134-
.map(|chan_id| *chan_id).collect::<Vec<_>>();
3135-
counterparty_channel_ids.insert(0, forward_chan_id);
3132+
let counterparty_channel_ids = core::iter::once(forward_chan_id)
3133+
.chain(peer_state.channel_by_id.keys()
3134+
.filter(|&chan_id| *chan_id != forward_chan_id)
3135+
.map(|&chan_id| chan_id))
3136+
.collect::<Vec<_>>();
31363137
let mut send_succeeded = false;
31373138
for chan_id in counterparty_channel_ids {
31383139
match peer_state.channel_by_id.get_mut(&chan_id).unwrap().send_htlc(amt_to_forward, payment_hash, outgoing_cltv_value, htlc_source.clone(), onion_packet.clone(), &self.logger) {

0 commit comments

Comments
 (0)