From 7fe3c4a605dad69ec623488c9a39bbb4cb44f615 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sat, 30 Jan 2021 14:17:14 +0100 Subject: [PATCH] Non-API breaking derives for error types --- src/blockdata/transaction.rs | 6 +++--- src/consensus/encode.rs | 2 -- src/util/base58.rs | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/blockdata/transaction.rs b/src/blockdata/transaction.rs index acf50987..71e30090 100644 --- a/src/blockdata/transaction.rs +++ b/src/blockdata/transaction.rs @@ -173,7 +173,7 @@ impl ::std::str::FromStr for OutPoint { } /// A transaction input, which defines old coins to be consumed -#[derive(Clone, PartialEq, Eq, Debug, Hash)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct TxIn { /// The reference to the previous output that is being used an an input @@ -206,7 +206,7 @@ impl Default for TxIn { } /// A transaction output, which defines new coins to be created from old ones. -#[derive(Clone, PartialEq, Eq, Debug, Hash)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct TxOut { /// The value of the output, in satoshis @@ -252,7 +252,7 @@ impl Default for TxOut { /// /// We therefore deviate from the spec by always using the Segwit witness encoding /// for 0-input transactions, which results in unambiguously parseable transactions. -#[derive(Clone, PartialEq, Eq, Debug, Hash)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Transaction { /// The protocol version, is currently expected to be 1 or 2 (BIP 68). diff --git a/src/consensus/encode.rs b/src/consensus/encode.rs index 54c8366f..9770ad77 100644 --- a/src/consensus/encode.rs +++ b/src/consensus/encode.rs @@ -118,8 +118,6 @@ impl error::Error for Error { } } -#[doc(hidden)] - #[doc(hidden)] impl From for Error { fn from(error: io::Error) -> Self { diff --git a/src/util/base58.rs b/src/util/base58.rs index 13949c55..97fdb045 100644 --- a/src/util/base58.rs +++ b/src/util/base58.rs @@ -21,7 +21,7 @@ use hashes::{sha256d, Hash}; use util::endian; /// An error that might occur during base58 decoding -#[derive(Debug, PartialEq, Eq, Clone)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone)] pub enum Error { /// Invalid character encountered BadByte(u8),