]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Use `Default::default()` for scoring params in tests
authorMatt Corallo <git@bluematt.me>
Fri, 20 Oct 2023 17:34:12 +0000 (17:34 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 21 Oct 2023 14:30:13 +0000 (14:30 +0000)
In 26c1639ab69d6780c97a118f09e42cb42304088a we switched to using
`Default::default()` to initialize `()` for scoring parameters in
tests. A number of `()`s slipped back in recently, which we replace
here.

lightning/src/ln/payment_tests.rs
lightning/src/routing/router.rs

index e25d8f06e45688446b13c2a5db68986ff6403423..b593a73eeb1496820d6e936006ad539937a6a09d 100644 (file)
@@ -1871,7 +1871,7 @@ fn do_test_intercepted_payment(test: InterceptTest) {
        let route_params = RouteParameters::from_payment_params_and_value(payment_params, amt_msat);
        let route = get_route(
                &nodes[0].node.get_our_node_id(), &route_params, &nodes[0].network_graph.read_only(), None,
        let route_params = RouteParameters::from_payment_params_and_value(payment_params, amt_msat);
        let route = get_route(
                &nodes[0].node.get_our_node_id(), &route_params, &nodes[0].network_graph.read_only(), None,
-               nodes[0].logger, &scorer, &(), &random_seed_bytes
+               nodes[0].logger, &scorer, &Default::default(), &random_seed_bytes
        ).unwrap();
 
        let (payment_hash, payment_secret) = nodes[2].node.create_inbound_payment(Some(amt_msat), 60 * 60, None).unwrap();
        ).unwrap();
 
        let (payment_hash, payment_secret) = nodes[2].node.create_inbound_payment(Some(amt_msat), 60 * 60, None).unwrap();
index fe73b37cf8b3d1a6fbe534bdf5d4c5846ade70cd..8e45a8779620c2fc8247c8bce2b13a3620c18404 100644 (file)
@@ -5417,7 +5417,7 @@ mod tests {
                                max_total_routing_fee_msat: Some(149_999) };
                        if let Err(LightningError{err, action: ErrorAction::IgnoreError}) = get_route(
                                &our_id, &route_params, &network_graph.read_only(), None, Arc::clone(&logger),
                                max_total_routing_fee_msat: Some(149_999) };
                        if let Err(LightningError{err, action: ErrorAction::IgnoreError}) = get_route(
                                &our_id, &route_params, &network_graph.read_only(), None, Arc::clone(&logger),
-                               &scorer, &(), &random_seed_bytes) {
+                               &scorer, &Default::default(), &random_seed_bytes) {
                                        assert_eq!(err, "Failed to find a sufficient route to the given destination");
                        } else { panic!(); }
                }
                                        assert_eq!(err, "Failed to find a sufficient route to the given destination");
                        } else { panic!(); }
                }
@@ -7357,7 +7357,7 @@ mod tests {
                let route_params = RouteParameters::from_payment_params_and_value(
                        payment_params, amt_msat);
                if let Err(LightningError { err, .. }) = get_route(
                let route_params = RouteParameters::from_payment_params_and_value(
                        payment_params, amt_msat);
                if let Err(LightningError { err, .. }) = get_route(
-                       &our_id, &route_params, &netgraph, None, Arc::clone(&logger), &scorer, &(), &random_seed_bytes
+                       &our_id, &route_params, &netgraph, None, Arc::clone(&logger), &scorer, &Default::default(), &random_seed_bytes
                ) {
                        assert_eq!(err, "Failed to find a path to the given destination");
                } else { panic!() }
                ) {
                        assert_eq!(err, "Failed to find a path to the given destination");
                } else { panic!() }
@@ -7414,7 +7414,7 @@ mod tests {
                let route_params = RouteParameters::from_payment_params_and_value(
                        payment_params, amt_msat);
                if let Err(LightningError { err, .. }) = get_route(
                let route_params = RouteParameters::from_payment_params_and_value(
                        payment_params, amt_msat);
                if let Err(LightningError { err, .. }) = get_route(
-                       &our_id, &route_params, &netgraph, None, Arc::clone(&logger), &scorer, &(), &random_seed_bytes
+                       &our_id, &route_params, &netgraph, None, Arc::clone(&logger), &scorer, &Default::default(), &random_seed_bytes
                ) {
                        assert_eq!(err, "Failed to find a path to the given destination");
                } else { panic!() }
                ) {
                        assert_eq!(err, "Failed to find a path to the given destination");
                } else { panic!() }
@@ -7492,7 +7492,7 @@ mod tests {
                        payment_params, amt_msat);
                if let Err(LightningError { err, .. }) = get_route(
                        &our_id, &route_params, &netgraph, Some(&first_hops.iter().collect::<Vec<_>>()),
                        payment_params, amt_msat);
                if let Err(LightningError { err, .. }) = get_route(
                        &our_id, &route_params, &netgraph, Some(&first_hops.iter().collect::<Vec<_>>()),
-                       Arc::clone(&logger), &scorer, &(), &random_seed_bytes
+                       Arc::clone(&logger), &scorer, &Default::default(), &random_seed_bytes
                ) {
                        assert_eq!(err, "Failed to find a path to the given destination");
                } else { panic!() }
                ) {
                        assert_eq!(err, "Failed to find a path to the given destination");
                } else { panic!() }
@@ -7578,7 +7578,7 @@ mod tests {
 
                let route = get_route(
                        &our_id, &route_params, &netgraph, Some(&first_hops.iter().collect::<Vec<_>>()),
 
                let route = get_route(
                        &our_id, &route_params, &netgraph, Some(&first_hops.iter().collect::<Vec<_>>()),
-                       Arc::clone(&logger), &scorer, &(), &random_seed_bytes
+                       Arc::clone(&logger), &scorer, &Default::default(), &random_seed_bytes
                ).unwrap();
                assert_eq!(route.paths.len(), 1);
                assert_eq!(route.get_total_amount(), amt_msat);
                ).unwrap();
                assert_eq!(route.paths.len(), 1);
                assert_eq!(route.get_total_amount(), amt_msat);