X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=lightning%2Fsrc%2Frouting%2Frouter.rs;fp=lightning%2Fsrc%2Frouting%2Frouter.rs;h=4214a1821cbbe7d110cf74ce44e77f0a8161e7fe;hb=3e0d55bd2b96ea10ecc744d4cbd9bbfc1ad4ef50;hp=1bf90883ec5a2d726cd9c95f99cc89000790729d;hpb=76ed917ddc97d431359d745df7ecbd5ce9237a31;p=rust-lightning diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index 1bf90883..4214a182 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -277,7 +277,7 @@ pub struct InFlightHtlcs( 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) { @@ -1962,7 +1962,7 @@ where L::Target: Logger { // 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() { @@ -1981,7 +1981,7 @@ where L::Target: Logger { } } - 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() ); @@ -2002,7 +2002,7 @@ where L::Target: Logger { // Map from node_id to information about the best current path to that node, including feerate // information. - let mut dist: HashMap = HashMap::with_capacity(network_nodes.len()); + let mut dist: HashMap = 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 @@ -2043,7 +2043,7 @@ where L::Target: Logger { // is used. Hence, liquidity used in one direction will not offset any used in the opposite // direction. let mut used_liquidities: HashMap = - 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.