@@ -125,7 +125,8 @@ pub(crate) use bitcoin_miniscript::policy::semantic::Policy as BtcPolicy;
125
125
pub ( crate ) use bitcoin_miniscript:: policy:: Liftable as BtcLiftable ;
126
126
// re-export imports
127
127
pub use bitcoin_miniscript:: {
128
- hash256, DummyKey , DummyKeyHash , ForEachKey , MiniscriptKey , ToPublicKey ,
128
+ hash256, DummyHash160Hash , DummyHash256Hash , DummyKey , DummyKeyHash , DummyRipemd160Hash ,
129
+ DummySha256Hash , ForEachKey , MiniscriptKey , ToPublicKey ,
129
130
} ;
130
131
pub ( crate ) use bitcoin_miniscript:: {
131
132
Descriptor as BtcDescriptor , Error as BtcError , Miniscript as BtcMiniscript ,
@@ -148,7 +149,7 @@ pub mod psbt;
148
149
mod test_utils;
149
150
mod util;
150
151
151
- use std:: { error, fmt, hash , str} ;
152
+ use std:: { error, fmt, str} ;
152
153
153
154
use elements:: hashes:: sha256;
154
155
use elements:: secp256k1_zkp:: Secp256k1 ;
@@ -216,85 +217,6 @@ where
216
217
contracthash:: tweak_key ( secp, pk, contract)
217
218
}
218
219
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
- }
298
220
/// Describes an object that can translate various keys and hashes from one key to the type
299
221
/// associated with the other key. Used by the [`TranslatePk`] trait to do the actual translations.
300
222
pub trait Translator < P , Q , E >
0 commit comments