Skip to content

Commit 2f3e457

Browse files
committed
Using BTreeMap in place of HashMap
Signed-off-by: Harshil Jani <[email protected]>
1 parent c17965a commit 2f3e457

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

src/miniscript/astelem.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Terminal<Pk, Ctx> {
181181
}
182182

183183
/// Substitutes raw public keys hashes with the public keys as provided by map.
184-
pub fn substitute_raw_pkh(&self, pk_map: &HashMap<hash160::Hash, Pk>) -> Terminal<Pk, Ctx> {
184+
pub fn substitute_raw_pkh(&self, pk_map: &BTreeMap<hash160::Hash, Pk>) -> Terminal<Pk, Ctx> {
185185
match self {
186186
Terminal::RawPkH(ref p) => match pk_map.get(p) {
187187
Some(pk) => Terminal::PkH(pk.clone()).into(),

src/miniscript/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Miniscript<Pk, Ctx> {
337337
}
338338

339339
/// Substitutes raw public keys hashes with the public keys as provided by map.
340-
pub fn substitute_raw_pkh(&self, pk_map: &HashMap<hash160::Hash, Pk>) -> Miniscript<Pk, Ctx> {
340+
pub fn substitute_raw_pkh(&self, pk_map: &BTreeMap<hash160::Hash, Pk>) -> Miniscript<Pk, Ctx> {
341341
Miniscript::from_ast(self.node.substitute_raw_pkh(pk_map)).expect("type check failed")
342342
}
343343
}

src/psbt/finalizer.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use bitcoin::secp256k1::{self, Secp256k1};
1414
use bitcoin::sighash::Prevouts;
1515
use bitcoin::taproot::LeafVersion;
1616
use bitcoin::{PublicKey, Script, ScriptBuf, TxOut, Witness};
17-
use std::collections::HashMap;
1817

1918
use super::{sanity_check, Error, InputError, Psbt, PsbtInputSatisfier};
2019
use crate::prelude::*;
@@ -125,7 +124,7 @@ pub(super) fn prevouts(psbt: &Psbt) -> Result<Vec<&bitcoin::TxOut>, super::Error
125124
// and we want to satisfy it in any way possible.
126125
fn get_descriptor(psbt: &Psbt, index: usize) -> Result<Descriptor<PublicKey>, InputError> {
127126
// Create a HashMap <Hash(Pk),Pk>
128-
let mut hash_map: HashMap<hash160::Hash, PublicKey> = HashMap::new();
127+
let mut hash_map: BTreeMap<hash160::Hash, PublicKey> = BTreeMap::new();
129128
let psbt_inputs = &psbt.inputs;
130129
for psbt_input in psbt_inputs {
131130
// Use BIP32 Derviation to get set of all possible keys.

0 commit comments

Comments
 (0)