+ if !prevented_redundant_path_selection {
+ // If we weren't capped by hitting a liquidity limit on a channel in the path,
+ // we'll probably end up picking the same path again on the next iteration.
+ // Randomly decrease the available liquidity of a hop in the middle of the
+ // path.
+ let victim_liquidity = bookkeeped_channels_liquidity_available_msat.get_mut(
+ &payment_path.hops[(payment_path.hops.len() - 1) / 2].route_hop.short_channel_id).unwrap();
+ *victim_liquidity = 0;
+ }
+