Fix SignersContainerKey PartialOrd to respect the ID

This commit is contained in:
Evgenii P 2020-12-15 11:33:33 +07:00
parent c075183a7b
commit 2658a9b05a
No known key found for this signature in database
GPG Key ID: 46717E4E65912EF7

View File

@ -112,7 +112,7 @@ use crate::descriptor::XKeyUtils;
/// Identifier of a signer in the `SignersContainers`. Used as a key to find the right signer among /// Identifier of a signer in the `SignersContainers`. Used as a key to find the right signer among
/// multiple of them /// multiple of them
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, Ord, PartialOrd, PartialEq, Eq, Hash)]
pub enum SignerId { pub enum SignerId {
PkHash(hash160::Hash), PkHash(hash160::Hash),
Fingerprint(Fingerprint), Fingerprint(Fingerprint),
@ -522,7 +522,7 @@ impl PartialOrd for SignersContainerKey {
impl Ord for SignersContainerKey { impl Ord for SignersContainerKey {
fn cmp(&self, other: &Self) -> Ordering { fn cmp(&self, other: &Self) -> Ordering {
self.ordering.cmp(&other.ordering) self.ordering.cmp(&other.ordering).then(self.id.cmp(&other.id))
} }
} }