@@ -125,7 +125,8 @@ pub(crate) use bitcoin_miniscript::policy::semantic::Policy as BtcPolicy;
125125pub ( crate ) use bitcoin_miniscript:: policy:: Liftable as BtcLiftable ;
126126// re-export imports
127127pub use bitcoin_miniscript:: {
128- hash256, DummyKey , DummyKeyHash , ForEachKey , MiniscriptKey , ToPublicKey ,
128+ hash256, DummyHash160Hash , DummyHash256Hash , DummyKey , DummyKeyHash , DummyRipemd160Hash ,
129+ DummySha256Hash , ForEachKey , MiniscriptKey , ToPublicKey ,
129130} ;
130131pub ( crate ) use bitcoin_miniscript:: {
131132 Descriptor as BtcDescriptor , Error as BtcError , Miniscript as BtcMiniscript ,
@@ -148,7 +149,7 @@ pub mod psbt;
148149mod test_utils;
149150mod util;
150151
151- use std:: { error, fmt, hash , str} ;
152+ use std:: { error, fmt, str} ;
152153
153154use elements:: hashes:: sha256;
154155use elements:: secp256k1_zkp:: Secp256k1 ;
@@ -216,85 +217,6 @@ where
216217 contracthash:: tweak_key ( secp, pk, contract)
217218}
218219
219- /// Dummy keyhash which de/serializes to the empty string; useful for testing
220- #[ derive( Copy , Clone , PartialOrd , Ord , PartialEq , Eq , Debug ) ]
221- pub struct DummyHash256 ;
222-
223- impl str:: FromStr for DummyHash256 {
224- type Err = & ' static str ;
225- fn from_str ( x : & str ) -> Result < DummyHash256 , & ' static str > {
226- if x. is_empty ( ) {
227- Ok ( DummyHash256 )
228- } else {
229- Err ( "non empty dummy hash" )
230- }
231- }
232- }
233-
234- /// Dummy keyhash which de/serializes to the empty string; useful for testing
235- #[ derive( Copy , Clone , PartialOrd , Ord , PartialEq , Eq , Debug ) ]
236- pub struct DummyRipemd160Hash ;
237-
238- impl str:: FromStr for DummyRipemd160Hash {
239- type Err = & ' static str ;
240- fn from_str ( x : & str ) -> Result < DummyRipemd160Hash , & ' static str > {
241- if x. is_empty ( ) {
242- Ok ( DummyRipemd160Hash )
243- } else {
244- Err ( "non empty dummy hash" )
245- }
246- }
247- }
248-
249- impl fmt:: Display for DummyHash256 {
250- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
251- f. write_str ( "" )
252- }
253- }
254- impl fmt:: Display for DummyRipemd160Hash {
255- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
256- f. write_str ( "" )
257- }
258- }
259-
260- impl hash:: Hash for DummyHash256 {
261- fn hash < H : hash:: Hasher > ( & self , state : & mut H ) {
262- "DummySha256Hash" . hash ( state) ;
263- }
264- }
265-
266- impl hash:: Hash for DummyRipemd160Hash {
267- fn hash < H : hash:: Hasher > ( & self , state : & mut H ) {
268- "DummyRipemd160Hash" . hash ( state) ;
269- }
270- }
271-
272- /// Dummy keyhash which de/serializes to the empty string; useful for testing
273- #[ derive( Copy , Clone , PartialOrd , Ord , PartialEq , Eq , Debug ) ]
274- pub struct DummyHash160Hash ;
275-
276- impl str:: FromStr for DummyHash160Hash {
277- type Err = & ' static str ;
278- fn from_str ( x : & str ) -> Result < DummyHash160Hash , & ' static str > {
279- if x. is_empty ( ) {
280- Ok ( DummyHash160Hash )
281- } else {
282- Err ( "non empty dummy hash" )
283- }
284- }
285- }
286-
287- impl fmt:: Display for DummyHash160Hash {
288- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
289- f. write_str ( "" )
290- }
291- }
292-
293- impl hash:: Hash for DummyHash160Hash {
294- fn hash < H : hash:: Hasher > ( & self , state : & mut H ) {
295- "DummyHash160Hash" . hash ( state) ;
296- }
297- }
298220/// Describes an object that can translate various keys and hashes from one key to the type
299221/// associated with the other key. Used by the [`TranslatePk`] trait to do the actual translations.
300222pub trait Translator < P , Q , E >
0 commit comments