Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/error derives 2 #559

Merged
merged 3 commits into from May 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions Cargo.toml
Expand Up @@ -14,20 +14,20 @@ readme = "README.md"
[features]
default = [ "secp-recovery" ]
base64 = [ "base64-compat" ]
fuzztarget = ["bitcoin_hashes/fuzztarget"]
fuzztarget = []
unstable = []
rand = ["secp256k1/rand-std"]
use-serde = ["serde", "bitcoin_hashes/serde", "secp256k1/serde"]
secp-lowmemory = ["secp256k1/lowmemory"]
secp-recovery = ["secp256k1/recovery"]

[dependencies]
bech32 = "0.7.2"
bitcoin_hashes = "0.9.1"
secp256k1 = "0.20.0"
bech32 = "0.7.3"
bitcoin_hashes = "0.9.6"
secp256k1 = "0.20.2"

base64-compat = { version = "1.0.0", optional = true }
bitcoinconsensus = { version = "0.19.0-1", optional = true }
bitcoinconsensus = { version = "0.19.0-3", optional = true }
serde = { version = "1", features = [ "derive" ], optional = true }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/blockdata/script.rs
Expand Up @@ -105,7 +105,7 @@ display_from_debug!(Builder);
/// Ways that a script might fail. Not everything is split up as
/// much as it could be; patches welcome if more detailed errors
/// would help you.
#[derive(PartialEq, Eq, Debug, Clone)]
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub enum Error {
/// Something did a non-minimal push; for more information see
/// `https://github.com/bitcoin/bips/blob/master/bip-0062.mediawiki#Push_operators`
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Expand Up @@ -99,8 +99,8 @@ pub use util::ecdsa::PublicKey;

#[cfg(all(test, feature = "unstable"))]
mod tests {
use hashes::core::fmt::Arguments;
use std::io::{IoSlice, Result, Write};
use std::fmt::Arguments;

#[derive(Default, Clone, Debug, PartialEq, Eq)]
pub struct EmptyWrite;
Expand Down
2 changes: 1 addition & 1 deletion src/util/address.rs
Expand Up @@ -49,7 +49,7 @@ use util::base58;
use util::ecdsa;

/// Address error.
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone)]
pub enum Error {
/// Base58 encoding error
Base58(base58::Error),
Expand Down
6 changes: 3 additions & 3 deletions src/util/bip32.rs
Expand Up @@ -423,16 +423,16 @@ impl fmt::Debug for DerivationPath {
pub type KeySource = (Fingerprint, DerivationPath);

/// A BIP32 error
#[derive(Clone, PartialEq, Eq, Debug)]
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum Error {
/// A pk->pk derivation was attempted on a hardened key
CannotDeriveFromHardenedKey,
/// A secp256k1 error occurred
Ecdsa(secp256k1::Error),
Ecdsa(secp256k1::Error), // TODO: This is not necessary ECDSA error and should be renamed
/// A child number was provided that was out of range
InvalidChildNumber(u32),
/// Error creating a master seed --- for application use
RngError(String),
RngError(String), // TODO: This option seems unused and should be removed, opening a way to make this type copiable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for application use, as mentioned in the doccomment.

/// Invalid childnumber format.
InvalidChildNumberFormat,
/// Invalid derivation path format.
Expand Down
2 changes: 1 addition & 1 deletion src/util/contracthash.rs
Expand Up @@ -36,7 +36,7 @@ use util::address;
static PUBKEY: u8 = 0xFE;

/// A contract-hash error
#[derive(Debug, PartialEq, Eq, Clone)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
pub enum Error {
/// Other secp256k1 related error
Secp(secp256k1::Error),
Expand Down
2 changes: 1 addition & 1 deletion src/util/key.rs
Expand Up @@ -26,7 +26,7 @@ use secp256k1;
use util::base58;

/// A key-related error.
#[derive(Debug, PartialEq, Eq, Clone)]
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum Error {
/// Base58 encoding error
Base58(base58::Error),
Expand Down
4 changes: 2 additions & 2 deletions src/util/psbt/error.rs
Expand Up @@ -21,7 +21,7 @@ use util::psbt::raw;

use hashes;

#[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
/// Enum for marking psbt hash error
pub enum PsbtHash {
Ripemd,
Expand All @@ -30,7 +30,7 @@ pub enum PsbtHash {
Hash256,
}
/// Ways that a Partially Signed Transaction might fail.
#[derive(Clone, PartialEq, Eq, Debug)]
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum Error {
/// Magic bytes for a PSBT must be the ASCII for "psbt" serialized in most
/// significant byte order.
Expand Down