From: Matt Corallo Date: Fri, 20 Oct 2023 17:34:12 +0000 (+0000) Subject: Use `Default::default()` for scoring params in tests X-Git-Tag: v0.0.118~2^2~8 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=50c55dcf32466e3ccf17acea50697fc664950deb;p=rust-lightning Use `Default::default()` for scoring params in tests 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. --- diff --git a/lightning/src/ln/payment_tests.rs b/lightning/src/ln/payment_tests.rs index e25d8f06e..b593a73ee 100644 --- a/lightning/src/ln/payment_tests.rs +++ b/lightning/src/ln/payment_tests.rs @@ -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, - 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(); diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index fe73b37cf..8e45a8779 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -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), - &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!(); } } @@ -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( - &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!() } @@ -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( - &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!() } @@ -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::>()), - 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!() } @@ -7578,7 +7578,7 @@ mod tests { let route = get_route( &our_id, &route_params, &netgraph, Some(&first_hops.iter().collect::>()), - 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);