Skip to content

Commit 4e2ee86

Browse files
committed
Use BTreeMap for descriptor::KeyMap
The `BTreeMap` is a drop in replacement for the `HashMap` with the benefit that it is available in no-std environments. Use a `BTreeMap` for the `despcriptor::KeyMap` instead of a `HashMap`. Done in preparation for removing the `hashbrown` dependency.
1 parent 49a2bdf commit 4e2ee86

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/descriptor/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub use self::key::{
5757
/// [`Descriptor::parse_descriptor`], since the descriptor will always only contain
5858
/// public keys. This map allows looking up the corresponding secret key given a
5959
/// public key from the descriptor.
60-
pub type KeyMap = HashMap<DescriptorPublicKey, DescriptorSecretKey>;
60+
pub type KeyMap = BTreeMap<DescriptorPublicKey, DescriptorSecretKey>;
6161

6262
/// Script descriptor
6363
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
@@ -656,7 +656,7 @@ impl Descriptor<DescriptorPublicKey> {
656656
Ok(public_key)
657657
}
658658

659-
let mut keymap_pk = KeyMapWrapper(HashMap::new(), secp);
659+
let mut keymap_pk = KeyMapWrapper(BTreeMap::new(), secp);
660660

661661
struct KeyMapWrapper<'a, C: secp256k1::Signing>(KeyMap, &'a secp256k1::Secp256k1<C>);
662662

0 commit comments

Comments
 (0)