- // ...and seed the scorer with success and failure data...
- seed = seed.overflowing_mul(6364136223846793005).0.overflowing_add(1).0;
- let mut score_amt = seed % 1_000_000_000;
- loop {
- // Generate fail/success paths for a wider range of potential amounts with
- // MPP enabled to give us a chance to apply penalties for more potential
- // routes.
- let mpp_features = channelmanager::provided_bolt11_invoice_features(&UserConfig::default());
- let params = PaymentParameters::from_node_id(dst, 42)
- .with_bolt11_features(mpp_features).unwrap();
- let route_params = RouteParameters::from_payment_params_and_value(
- params.clone(), score_amt);
- let route_res = get_route(&payer, &route_params, &graph.read_only(),
- Some(&[&first_hop]), &TestLogger::new(), scorer, score_params,
- &random_seed_bytes);
- if let Ok(route) = route_res {
- for path in route.paths {
- if seed & 0x80 == 0 {
- scorer.payment_path_successful(&path, Duration::ZERO);
- } else {
- let short_channel_id = path.hops[path.hops.len() / 2].short_channel_id;
- scorer.payment_path_failed(&path, short_channel_id, Duration::ZERO);
- }
- seed = seed.overflowing_mul(6364136223846793005).0.overflowing_add(1).0;
- }
- break;
- }
- // If we couldn't find a path with a higer amount, reduce and try again.
- score_amt /= 100;
- }
-