Skip to content

Commit 73882a8

Browse files
committed
Rename RandomStrategy into RandomWalkStrategy
1 parent 7152553 commit 73882a8

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ use crate::message_handler::NodeCustomMessageHandler;
7878
use crate::payment::asynchronous::om_mailbox::OnionMessageMailbox;
7979
use crate::peer_store::PeerStore;
8080
use crate::probing::{
81-
HighDegreeStrategy, Prober, ProbingConfig, ProbingStrategy, ProbingStrategyKind, RandomStrategy,
81+
HighDegreeStrategy, Prober, ProbingConfig, ProbingStrategy, ProbingStrategyKind, RandomWalkStrategy,
8282
};
8383
use crate::runtime::{Runtime, RuntimeSpawner};
8484
use crate::tx_broadcaster::TransactionBroadcaster;
@@ -2097,7 +2097,7 @@ fn build_with_store_internal(
20972097
config.probing_liquidity_limit_multiplier,
20982098
))
20992099
},
2100-
ProbingStrategyKind::Random { max_hops } => Arc::new(RandomStrategy::new(
2100+
ProbingStrategyKind::RandomWalk { max_hops } => Arc::new(RandomWalkStrategy::new(
21012101
Arc::clone(&network_graph),
21022102
Arc::clone(&channel_manager),
21032103
*max_hops,

src/probing.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
//! their capacities, providing accurate data to the scorer and router.
1919
//!
2020
//! This module provides the configuration for such a service. There are two pre-built strategies,
21-
//! [`RandomStrategy`] and [`HighDegreeStrategy`], as well as a [`ProbingStrategy`] trait which
21+
//! [`RandomWalkStrategy`] and [`HighDegreeStrategy`], as well as a [`ProbingStrategy`] trait which
2222
//! allows defining a custom probing strategy (for example if there is an established payment
2323
//! pattern).
2424
//!
@@ -89,7 +89,7 @@ use crate::util::random_range;
8989
#[derive(Clone)]
9090
pub(crate) enum ProbingStrategyKind {
9191
HighDegree { top_node_count: usize },
92-
Random { max_hops: usize },
92+
RandomWalk { max_hops: usize },
9393
Custom(Arc<dyn ProbingStrategy>),
9494
}
9595

@@ -99,8 +99,8 @@ impl fmt::Debug for ProbingStrategyKind {
9999
Self::HighDegree { top_node_count } => {
100100
f.debug_struct("HighDegree").field("top_node_count", top_node_count).finish()
101101
},
102-
Self::Random { max_hops } => {
103-
f.debug_struct("Random").field("max_hops", max_hops).finish()
102+
Self::RandomWalk { max_hops } => {
103+
f.debug_struct("RandomWalk").field("max_hops", max_hops).finish()
104104
},
105105
Self::Custom(_) => f.write_str("Custom(<probing strategy>)"),
106106
}
@@ -206,7 +206,7 @@ impl ProbingConfigBuilder {
206206
/// `max_hops` is the upper bound on the number of hops in a randomly constructed path.
207207
/// Values below `2` are clamped to `2`.
208208
pub fn random_walk(max_hops: usize) -> Self {
209-
Self::with_kind(ProbingStrategyKind::Random { max_hops })
209+
Self::with_kind(ProbingStrategyKind::RandomWalk { max_hops })
210210
}
211211

212212
/// Start building a config with a custom [`ProbingStrategy`] implementation.
@@ -238,7 +238,7 @@ impl ProbingConfigBuilder {
238238
///
239239
/// This is only useful for probing strategies that route through the scorer
240240
/// (e.g., [`HighDegreeStrategy`]). Strategies that build paths manually
241-
/// (e.g., [`RandomStrategy`]) bypass the scorer entirely.
241+
/// (e.g., [`RandomWalkStrategy`]) bypass the scorer entirely.
242242
///
243243
/// If unset, LDK's default of `0` (no penalty) is used.
244244
pub fn diversity_penalty_msat(&mut self, penalty_msat: u64) -> &mut Self {
@@ -326,7 +326,7 @@ impl ArcedProbingConfigBuilder {
326326
///
327327
/// This is only useful for probing strategies that route through the scorer
328328
/// (e.g., [`HighDegreeStrategy`]). Strategies that build paths manually
329-
/// (e.g., [`RandomStrategy`]) bypass the scorer entirely.
329+
/// (e.g., [`RandomWalkStrategy`]) bypass the scorer entirely.
330330
///
331331
/// If unset, LDK's default of `0` (no penalty) is used.
332332
pub fn set_diversity_penalty_msat(&self, penalty_msat: u64) {
@@ -504,8 +504,8 @@ impl ProbingStrategy for HighDegreeStrategy {
504504
/// Because path selection ignores the scorer, this probes channels the router
505505
/// would never try on its own, teaching the scorer about previously unknown paths.
506506
///
507-
/// `RandomStrategy` can only use publicly announced channels for probing.
508-
pub struct RandomStrategy {
507+
/// `RandomWalkStrategy` can only use publicly announced channels for probing.
508+
pub struct RandomWalkStrategy {
509509
network_graph: Arc<Graph>,
510510
channel_manager: Arc<ChannelManager>,
511511
/// Upper bound on the number of hops in a randomly constructed path.
@@ -516,7 +516,7 @@ pub struct RandomStrategy {
516516
pub max_amount_msat: u64,
517517
}
518518

519-
impl RandomStrategy {
519+
impl RandomWalkStrategy {
520520
/// Creates a new random-walk probing strategy.
521521
pub(crate) fn new(
522522
network_graph: Arc<Graph>, channel_manager: Arc<ChannelManager>, max_hops: usize,
@@ -722,7 +722,7 @@ impl RandomStrategy {
722722
}
723723
}
724724

725-
impl ProbingStrategy for RandomStrategy {
725+
impl ProbingStrategy for RandomWalkStrategy {
726726
fn next_probe(&self) -> Option<Path> {
727727
let target_hops = random_range(2, self.max_hops as u64) as usize;
728728
let amount_msat = random_range(self.min_amount_msat, self.max_amount_msat);

0 commit comments

Comments
 (0)