From: Jeffrey Czyz Date: Mon, 17 Jan 2022 04:12:58 +0000 (-0600) Subject: Deprecate Scorer in favor of ProbabilisticScorer X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=28edee548c0f7cc424b4bd6aa862827298284a4d;p=rust-lightning Deprecate Scorer in favor of ProbabilisticScorer --- diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index c777bfd3d..4955ecc30 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -1528,7 +1528,7 @@ where L::Target: Logger { #[cfg(test)] mod tests { - use routing::scoring::Score; + use routing::scoring::{ProbabilisticScorer, ProbabilisticScoringParameters, Score}; use routing::network_graph::{NetworkGraph, NetGraphMsgHandler, NodeId}; use routing::router::{get_route, Payee, Route, RouteHint, RouteHintHop, RouteHop, RoutingFees}; use chain::transaction::OutPoint; @@ -4901,7 +4901,6 @@ mod tests { }, }; let graph = NetworkGraph::read(&mut d).unwrap(); - let scorer = test_utils::TestScorer::with_fixed_penalty(0); // First, get 100 (source, destination) pairs for which route-getting actually succeeds... let mut seed = random_init_seed() as usize; @@ -4914,6 +4913,8 @@ mod tests { let dst = PublicKey::from_slice(nodes.keys().skip(seed % nodes.len()).next().unwrap().as_slice()).unwrap(); let payee = Payee::from_node_id(dst); let amt = seed as u64 % 200_000_000; + let params = ProbabilisticScoringParameters::default(); + let scorer = ProbabilisticScorer::new(params, &src, &graph); if get_route(src, &payee, &graph, None, amt, 42, &test_utils::TestLogger::new(), &scorer).is_ok() { continue 'load_endpoints; } @@ -4932,7 +4933,6 @@ mod tests { }, }; let graph = NetworkGraph::read(&mut d).unwrap(); - let scorer = test_utils::TestScorer::with_fixed_penalty(0); // First, get 100 (source, destination) pairs for which route-getting actually succeeds... let mut seed = random_init_seed() as usize; @@ -4945,6 +4945,8 @@ mod tests { let dst = PublicKey::from_slice(nodes.keys().skip(seed % nodes.len()).next().unwrap().as_slice()).unwrap(); let payee = Payee::from_node_id(dst).with_features(InvoiceFeatures::known()); let amt = seed as u64 % 200_000_000; + let params = ProbabilisticScoringParameters::default(); + let scorer = ProbabilisticScorer::new(params, &src, &graph); if get_route(src, &payee, &graph, None, amt, 42, &test_utils::TestLogger::new(), &scorer).is_ok() { continue 'load_endpoints; } diff --git a/lightning/src/routing/scoring.rs b/lightning/src/routing/scoring.rs index f554b103b..311ddadac 100644 --- a/lightning/src/routing/scoring.rs +++ b/lightning/src/routing/scoring.rs @@ -198,6 +198,10 @@ impl<'a, S: Writeable> Writeable for MutexGuard<'a, S> { /// See [module-level documentation] for usage and [`ScoringParameters`] for customization. /// /// [module-level documentation]: crate::routing::scoring +#[deprecated( + since = "0.0.105", + note = "ProbabilisticScorer should be used instead of Scorer.", +)] pub type Scorer = ScorerUsingTime::; #[cfg(not(feature = "no-std"))]