Derive Hash on a bunch of types
In preparation for being able to derive `Hash` on all types in `miniscript`, derive `Hash` on all of the required types.
This commit is contained in:
parent
9cfa9bd9df
commit
ef7fef001c
|
@ -852,7 +852,7 @@ pub type SigHashType = EcdsaSighashType;
|
|||
///
|
||||
/// Fixed values so they can be cast as integer types for encoding (see also
|
||||
/// [`SchnorrSighashType`]).
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone, Hash)]
|
||||
pub enum EcdsaSighashType {
|
||||
/// 0x1: Sign all outputs.
|
||||
All = 0x01,
|
||||
|
|
|
@ -14,7 +14,7 @@ use secp256k1;
|
|||
use crate::EcdsaSighashType;
|
||||
|
||||
/// An ECDSA signature with the corresponding hash type.
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
||||
pub struct EcdsaSig {
|
||||
|
|
|
@ -68,7 +68,7 @@ const PSBT_IN_PROPRIETARY: u8 = 0xFC;
|
|||
|
||||
/// A key-value map for an input of the corresponding index in the unsigned
|
||||
/// transaction.
|
||||
#[derive(Clone, Default, Debug, PartialEq, Eq)]
|
||||
#[derive(Clone, Default, Debug, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
||||
pub struct Input {
|
||||
|
|
|
@ -36,7 +36,7 @@ const PSBT_OUT_PROPRIETARY: u8 = 0xFC;
|
|||
|
||||
/// A key-value map for an output of the corresponding index in the unsigned
|
||||
/// transaction.
|
||||
#[derive(Clone, Default, Debug, PartialEq, Eq)]
|
||||
#[derive(Clone, Default, Debug, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
||||
pub struct Output {
|
||||
|
@ -123,6 +123,12 @@ impl PartialEq for TapTree {
|
|||
}
|
||||
}
|
||||
|
||||
impl core::hash::Hash for TapTree {
|
||||
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
|
||||
self.node_info().hash(state)
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for TapTree {}
|
||||
|
||||
impl From<TapTree> for TaprootBuilder {
|
||||
|
|
|
@ -37,7 +37,7 @@ use crate::util::bip32::{ExtendedPubKey, KeySource};
|
|||
pub type Psbt = PartiallySignedTransaction;
|
||||
|
||||
/// A Partially Signed Transaction.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
||||
pub struct PartiallySignedTransaction {
|
||||
|
|
|
@ -205,7 +205,7 @@ impl From<TweakedKeyPair> for crate::KeyPair {
|
|||
}
|
||||
|
||||
/// A BIP340-341 serialized schnorr signature with the corresponding hash type.
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
||||
pub struct SchnorrSig {
|
||||
|
|
Loading…
Reference in New Issue