]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Deprecate Scorer in favor of ProbabilisticScorer
authorJeffrey Czyz <jkczyz@gmail.com>
Mon, 17 Jan 2022 04:12:58 +0000 (22:12 -0600)
committerJeffrey Czyz <jkczyz@gmail.com>
Thu, 20 Jan 2022 22:14:47 +0000 (16:14 -0600)
lightning/src/routing/router.rs
lightning/src/routing/scoring.rs

index c777bfd3dcc84b257429ef9c5bcc5213d008f9ac..4955ecc303c2028a29b48273de0fcd0f39d10c74 100644 (file)
@@ -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;
                                }
index f554b103b3325b0fa5699cda891c8b7357c2de28..311ddadac3d51b2c983745f9bb543ace72109265 100644 (file)
@@ -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::<ConfiguredTime>;
 
 #[cfg(not(feature = "no-std"))]