Skip to content

Commit 44bad5e

Browse files
author
cdmoss
committed
drop limit to 3 and remove randomization
1 parent 4438f86 commit 44bad5e

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

lightning-invoice/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ num-traits = { version = "0.2.8", default-features = false }
2727
bitcoin_hashes = { version = "0.11", default-features = false }
2828
hashbrown = { version = "0.8", optional = true }
2929
serde = { version = "1.0.118", optional = true }
30-
rand = "0.8.5"
3130

3231
[dev-dependencies]
3332
lightning = { version = "0.0.112", path = "../lightning", default-features = false, features = ["_test_utils"] }

lightning-invoice/src/utils.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ use lightning::util::logger::Logger;
2020
use secp256k1::PublicKey;
2121
use core::ops::Deref;
2222
use core::time::Duration;
23-
use rand::thread_rng;
24-
use rand::seq::SliceRandom;
2523

2624
#[cfg(feature = "std")]
2725
/// Utility to create an invoice that can be paid to one of multiple nodes, or a "phantom invoice."
@@ -531,7 +529,7 @@ fn filter_channels<L: Deref>(
531529
// the payment value and where we're currently connected to the channel counterparty.
532530
// Even if we cannot satisfy both goals, always ensure we include *some* hints, preferring
533531
// those which meet at least one criteria.
534-
let mut final_channels = filtered_channels
532+
filtered_channels
535533
.into_iter()
536534
.map(|(_, channel)| channel)
537535
.filter(|channel| {
@@ -565,12 +563,8 @@ fn filter_channels<L: Deref>(
565563
})
566564
.map(route_hint_from_channel)
567565
// Following LND's lead by taking max 20 hints
568-
.take(20)
569-
.collect::<Vec<RouteHint>>();
570-
571-
// Shuffle selected channels to prevent channel exhaustion
572-
final_channels.shuffle(&mut thread_rng());
573-
final_channels
566+
.take(3)
567+
.collect::<Vec<RouteHint>>()
574568
}
575569

576570
impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> Payer for ChannelManager<M, T, K, F, L>

0 commit comments

Comments
 (0)