impl InFlightHtlcs {
/// Constructs an empty `InFlightHtlcs`.
- pub fn new() -> Self { InFlightHtlcs(HashMap::new()) }
+ pub fn new() -> Self { InFlightHtlcs(new_hash_map()) }
/// Takes in a path with payer's node id and adds the path's details to `InFlightHtlcs`.
pub fn process_path(&mut self, path: &Path, payer_node_id: PublicKey) {
// inserting first hops suggested by the caller as targets.
// Our search will then attempt to reach them while traversing from the payee node.
let mut first_hop_targets: HashMap<_, Vec<&ChannelDetails>> =
- HashMap::with_capacity(if first_hops.is_some() { first_hops.as_ref().unwrap().len() } else { 0 });
+ hash_map_with_capacity(if first_hops.is_some() { first_hops.as_ref().unwrap().len() } else { 0 });
if let Some(hops) = first_hops {
for chan in hops {
if chan.get_outbound_payment_scid().is_none() {
}
}
- let mut private_hop_key_cache = HashMap::with_capacity(
+ let mut private_hop_key_cache = hash_map_with_capacity(
payment_params.payee.unblinded_route_hints().iter().map(|path| path.0.len()).sum()
);
// Map from node_id to information about the best current path to that node, including feerate
// information.
- let mut dist: HashMap<NodeId, PathBuildingHop> = HashMap::with_capacity(network_nodes.len());
+ let mut dist: HashMap<NodeId, PathBuildingHop> = hash_map_with_capacity(network_nodes.len());
// During routing, if we ignore a path due to an htlc_minimum_msat limit, we set this,
// indicating that we may wish to try again with a higher value, potentially paying to meet an
// is used. Hence, liquidity used in one direction will not offset any used in the opposite
// direction.
let mut used_liquidities: HashMap<CandidateHopId, u64> =
- HashMap::with_capacity(network_nodes.len());
+ hash_map_with_capacity(network_nodes.len());
// Keeping track of how much value we already collected across other paths. Helps to decide
// when we want to stop looking for new paths.