diff --git a/src/miniscript/mod.rs b/src/miniscript/mod.rs index d72a51d9a..4d580c94b 100644 --- a/src/miniscript/mod.rs +++ b/src/miniscript/mod.rs @@ -25,7 +25,7 @@ //! use std::marker::PhantomData; -use std::{fmt, str}; +use std::{fmt, hash, str}; use bitcoin::blockdata::script; use bitcoin::util::taproot::{LeafVersion, TapLeafHash}; @@ -57,7 +57,7 @@ use crate::{expression, Error, ForEach, ForEachKey, MiniscriptKey, ToPublicKey, mod ms_tests; /// Top-level script AST type -#[derive(Clone, Hash)] +#[derive(Clone)] pub struct Miniscript { ///A node in the Abstract Syntax Tree( pub node: Terminal, @@ -107,6 +107,12 @@ impl fmt::Debug for Miniscript { } } +impl hash::Hash for Miniscript { + fn hash(&self, state: &mut H) { + self.node.hash(state); + } +} + impl Miniscript { /// Add type information(Type and Extdata) to Miniscript based on /// `AstElem` fragment. Dependent on display and clone because of Error