@@ -1221,7 +1221,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
12211221 channel_parameters. clone ( ) , initial_holder_commitment_tx, secp_ctx
12221222 ) ;
12231223
1224- let mut outputs_to_watch = HashMap :: new ( ) ;
1224+ let mut outputs_to_watch = new_hash_map ( ) ;
12251225 outputs_to_watch. insert ( funding_info. 0 . txid , vec ! [ ( funding_info. 0 . index as u32 , funding_info. 1 . clone( ) ) ] ) ;
12261226
12271227 Self :: from_impl ( ChannelMonitorImpl {
@@ -1247,17 +1247,17 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
12471247 on_holder_tx_csv : counterparty_channel_parameters. selected_contest_delay ,
12481248
12491249 commitment_secrets : CounterpartyCommitmentSecrets :: new ( ) ,
1250- counterparty_claimable_outpoints : HashMap :: new ( ) ,
1251- counterparty_commitment_txn_on_chain : HashMap :: new ( ) ,
1252- counterparty_hash_commitment_number : HashMap :: new ( ) ,
1253- counterparty_fulfilled_htlcs : HashMap :: new ( ) ,
1250+ counterparty_claimable_outpoints : new_hash_map ( ) ,
1251+ counterparty_commitment_txn_on_chain : new_hash_map ( ) ,
1252+ counterparty_hash_commitment_number : new_hash_map ( ) ,
1253+ counterparty_fulfilled_htlcs : new_hash_map ( ) ,
12541254
12551255 prev_holder_signed_commitment_tx : None ,
12561256 current_holder_commitment_tx : holder_commitment_tx,
12571257 current_counterparty_commitment_number : 1 << 48 ,
12581258 current_holder_commitment_number,
12591259
1260- payment_preimages : HashMap :: new ( ) ,
1260+ payment_preimages : new_hash_map ( ) ,
12611261 pending_monitor_events : Vec :: new ( ) ,
12621262 pending_events : Vec :: new ( ) ,
12631263 is_processing_pending_events : false ,
@@ -2154,7 +2154,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
21542154 /// HTLCs which were resolved on-chain (i.e. where the final HTLC resolution was done by an
21552155 /// event from this `ChannelMonitor`).
21562156 pub ( crate ) fn get_all_current_outbound_htlcs ( & self ) -> HashMap < HTLCSource , ( HTLCOutputInCommitment , Option < PaymentPreimage > ) > {
2157- let mut res = HashMap :: new ( ) ;
2157+ let mut res = new_hash_map ( ) ;
21582158 // Just examine the available counterparty commitment transactions. See docs on
21592159 // `fail_unbroadcast_htlcs`, below, for justification.
21602160 let us = self . inner . lock ( ) . unwrap ( ) ;
@@ -2206,7 +2206,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
22062206 return self . get_all_current_outbound_htlcs ( ) ;
22072207 }
22082208
2209- let mut res = HashMap :: new ( ) ;
2209+ let mut res = new_hash_map ( ) ;
22102210 macro_rules! walk_htlcs {
22112211 ( $holder_commitment: expr, $htlc_iter: expr) => {
22122212 for ( htlc, source) in $htlc_iter {
@@ -3916,7 +3916,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
39163916 /// Filters a block's `txdata` for transactions spending watched outputs or for any child
39173917 /// transactions thereof.
39183918 fn filter_block < ' a > ( & self , txdata : & TransactionData < ' a > ) -> Vec < & ' a Transaction > {
3919- let mut matched_txn = HashSet :: new ( ) ;
3919+ let mut matched_txn = new_hash_set ( ) ;
39203920 txdata. iter ( ) . filter ( |& & ( _, tx) | {
39213921 let mut matches = self . spends_watched_output ( tx) ;
39223922 for input in tx. input . iter ( ) {
@@ -4431,7 +4431,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
44314431 }
44324432
44334433 let counterparty_claimable_outpoints_len: u64 = Readable :: read ( reader) ?;
4434- let mut counterparty_claimable_outpoints = HashMap :: with_capacity ( cmp:: min ( counterparty_claimable_outpoints_len as usize , MAX_ALLOC_SIZE / 64 ) ) ;
4434+ let mut counterparty_claimable_outpoints = hash_map_with_capacity ( cmp:: min ( counterparty_claimable_outpoints_len as usize , MAX_ALLOC_SIZE / 64 ) ) ;
44354435 for _ in 0 ..counterparty_claimable_outpoints_len {
44364436 let txid: Txid = Readable :: read ( reader) ?;
44374437 let htlcs_count: u64 = Readable :: read ( reader) ?;
@@ -4445,7 +4445,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
44454445 }
44464446
44474447 let counterparty_commitment_txn_on_chain_len: u64 = Readable :: read ( reader) ?;
4448- let mut counterparty_commitment_txn_on_chain = HashMap :: with_capacity ( cmp:: min ( counterparty_commitment_txn_on_chain_len as usize , MAX_ALLOC_SIZE / 32 ) ) ;
4448+ let mut counterparty_commitment_txn_on_chain = hash_map_with_capacity ( cmp:: min ( counterparty_commitment_txn_on_chain_len as usize , MAX_ALLOC_SIZE / 32 ) ) ;
44494449 for _ in 0 ..counterparty_commitment_txn_on_chain_len {
44504450 let txid: Txid = Readable :: read ( reader) ?;
44514451 let commitment_number = <U48 as Readable >:: read ( reader) ?. 0 ;
@@ -4455,7 +4455,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
44554455 }
44564456
44574457 let counterparty_hash_commitment_number_len: u64 = Readable :: read ( reader) ?;
4458- let mut counterparty_hash_commitment_number = HashMap :: with_capacity ( cmp:: min ( counterparty_hash_commitment_number_len as usize , MAX_ALLOC_SIZE / 32 ) ) ;
4458+ let mut counterparty_hash_commitment_number = hash_map_with_capacity ( cmp:: min ( counterparty_hash_commitment_number_len as usize , MAX_ALLOC_SIZE / 32 ) ) ;
44594459 for _ in 0 ..counterparty_hash_commitment_number_len {
44604460 let payment_hash: PaymentHash = Readable :: read ( reader) ?;
44614461 let commitment_number = <U48 as Readable >:: read ( reader) ?. 0 ;
@@ -4478,7 +4478,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
44784478 let current_holder_commitment_number = <U48 as Readable >:: read ( reader) ?. 0 ;
44794479
44804480 let payment_preimages_len: u64 = Readable :: read ( reader) ?;
4481- let mut payment_preimages = HashMap :: with_capacity ( cmp:: min ( payment_preimages_len as usize , MAX_ALLOC_SIZE / 32 ) ) ;
4481+ let mut payment_preimages = hash_map_with_capacity ( cmp:: min ( payment_preimages_len as usize , MAX_ALLOC_SIZE / 32 ) ) ;
44824482 for _ in 0 ..payment_preimages_len {
44834483 let preimage: PaymentPreimage = Readable :: read ( reader) ?;
44844484 let hash = PaymentHash ( Sha256 :: hash ( & preimage. 0 [ ..] ) . to_byte_array ( ) ) ;
@@ -4518,7 +4518,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
45184518 }
45194519
45204520 let outputs_to_watch_len: u64 = Readable :: read ( reader) ?;
4521- let mut outputs_to_watch = HashMap :: with_capacity ( cmp:: min ( outputs_to_watch_len as usize , MAX_ALLOC_SIZE / ( mem:: size_of :: < Txid > ( ) + mem:: size_of :: < u32 > ( ) + mem:: size_of :: < Vec < ScriptBuf > > ( ) ) ) ) ;
4521+ let mut outputs_to_watch = hash_map_with_capacity ( cmp:: min ( outputs_to_watch_len as usize , MAX_ALLOC_SIZE / ( mem:: size_of :: < Txid > ( ) + mem:: size_of :: < u32 > ( ) + mem:: size_of :: < Vec < ScriptBuf > > ( ) ) ) ) ;
45224522 for _ in 0 ..outputs_to_watch_len {
45234523 let txid = Readable :: read ( reader) ?;
45244524 let outputs_len: u64 = Readable :: read ( reader) ?;
@@ -4560,7 +4560,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
45604560 let mut counterparty_node_id = None ;
45614561 let mut confirmed_commitment_tx_counterparty_output = None ;
45624562 let mut spendable_txids_confirmed = Some ( Vec :: new ( ) ) ;
4563- let mut counterparty_fulfilled_htlcs = Some ( HashMap :: new ( ) ) ;
4563+ let mut counterparty_fulfilled_htlcs = Some ( new_hash_map ( ) ) ;
45644564 let mut initial_counterparty_commitment_info = None ;
45654565 read_tlv_fields ! ( reader, {
45664566 ( 1 , funding_spend_confirmed, option) ,
0 commit comments