diff --git a/src/plan.rs b/src/plan.rs index f6c79eb11..a3c75860b 100644 --- a/src/plan.rs +++ b/src/plan.rs @@ -461,7 +461,7 @@ impl Plan { } } -#[derive(Clone, Debug, PartialEq, Eq, Hash)] +#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] /// Signatures which a key can produce /// /// Defaults to `ecdsa=true` and `taproot=TaprootCanSign::default()` @@ -481,7 +481,7 @@ impl Default for CanSign { } } -#[derive(Clone, Debug, PartialEq, Eq, Hash)] +#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] /// Signatures which a taproot key can produce /// /// Defaults to `key_spend=true`, `script_spend=Any` and `sighash_default=true` @@ -513,7 +513,7 @@ impl Default for TaprootCanSign { } } -#[derive(Clone, Debug, PartialEq, Eq, Hash)] +#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] /// Which taproot leaves the key can sign for pub enum TaprootAvailableLeaves { /// Cannot sign for any leaf @@ -547,15 +547,15 @@ pub struct Assets { /// derived with either `derivation_path` or a derivation path that extends `derivation_path` /// by exactly one child number. For example, if the derivation path `m/0/1` is provided, the /// user can sign with either `m/0/1` or `m/0/1/*`. - pub keys: HashSet<(bip32::KeySource, CanSign)>, + pub keys: BTreeSet<(bip32::KeySource, CanSign)>, /// Set of available sha256 preimages - pub sha256_preimages: HashSet, + pub sha256_preimages: BTreeSet, /// Set of available hash256 preimages - pub hash256_preimages: HashSet, + pub hash256_preimages: BTreeSet, /// Set of available ripemd160 preimages - pub ripemd160_preimages: HashSet, + pub ripemd160_preimages: BTreeSet, /// Set of available hash160 preimages - pub hash160_preimages: HashSet, + pub hash160_preimages: BTreeSet, /// Maximum absolute timelock allowed pub absolute_timelock: Option, /// Maximum relative timelock allowed @@ -680,7 +680,7 @@ impl AssetProvider for Assets { impl FromIterator for Assets { fn from_iter>(iter: I) -> Self { - let mut keys = HashSet::new(); + let mut keys = BTreeSet::new(); for pk in iter { for deriv_path in pk.full_derivation_paths() { keys.insert(((pk.master_fingerprint(), deriv_path), CanSign::default())); @@ -700,8 +700,8 @@ pub trait IntoAssets { } impl IntoAssets for KeyMap { - fn into_assets(mut self) -> Assets { - Assets::from_iter(self.drain().map(|(k, _)| k)) + fn into_assets(self) -> Assets { + Assets::from_iter(self.into_iter().map(|(k, _)| k)) } }