Merge pull request #443 from sgeisler/2020-06-bip32-derive-more

Derive more traits to use for bip32 Types
This commit is contained in:
Elichai Turkel 2020-07-23 11:24:50 +03:00 committed by GitHub
commit 478e091af6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -64,7 +64,7 @@ pub struct ExtendedPrivKey {
serde_string_impl!(ExtendedPrivKey, "a BIP-32 extended private key"); serde_string_impl!(ExtendedPrivKey, "a BIP-32 extended private key");
/// Extended public key /// Extended public key
#[derive(Copy, Clone, PartialEq, Eq, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Debug, PartialOrd, Ord, Hash)]
pub struct ExtendedPubKey { pub struct ExtendedPubKey {
/// The network this key is to be used on /// The network this key is to be used on
pub network: Network, pub network: Network,
@ -82,7 +82,7 @@ pub struct ExtendedPubKey {
serde_string_impl!(ExtendedPubKey, "a BIP-32 extended public key"); serde_string_impl!(ExtendedPubKey, "a BIP-32 extended public key");
/// A child number for a derived key /// A child number for a derived key
#[derive(Copy, Clone, PartialEq, Eq, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Debug, PartialOrd, Ord, Hash)]
pub enum ChildNumber { pub enum ChildNumber {
/// Non-hardened key /// Non-hardened key
Normal { Normal {
@ -209,7 +209,7 @@ impl serde::Serialize for ChildNumber {
} }
/// A BIP-32 derivation path. /// A BIP-32 derivation path.
#[derive(Clone, PartialEq, Eq)] #[derive(Clone, PartialEq, Eq, Ord, PartialOrd, Hash)]
pub struct DerivationPath(Vec<ChildNumber>); pub struct DerivationPath(Vec<ChildNumber>);
impl_index_newtype!(DerivationPath, ChildNumber); impl_index_newtype!(DerivationPath, ChildNumber);
serde_string_impl!(DerivationPath, "a BIP-32 derivation path"); serde_string_impl!(DerivationPath, "a BIP-32 derivation path");