@@ -239,27 +239,40 @@ impl_satisfier_for_map_hash_to_key_ecdsa_sig! {
239
239
impl Satisfier <Pk > for HashMap <hash160:: Hash , ( Pk , bitcoin:: ecdsa:: Signature ) >
240
240
}
241
241
242
- impl < Pk : MiniscriptKey + ToPublicKey > Satisfier < Pk >
243
- for HashMap < ( hash160:: Hash , TapLeafHash ) , ( Pk , bitcoin:: taproot:: Signature ) >
244
- where
245
- Pk : MiniscriptKey + ToPublicKey ,
246
- {
247
- fn lookup_tap_leaf_script_sig (
248
- & self ,
249
- key : & Pk ,
250
- h : & TapLeafHash ,
251
- ) -> Option < bitcoin:: taproot:: Signature > {
252
- self . get ( & ( key. to_pubkeyhash ( SigType :: Schnorr ) , * h) )
253
- . map ( |x| x. 1 )
254
- }
242
+ macro_rules! impl_satisfier_for_map_hash_tapleafhash_to_key_taproot_sig {
243
+ ( $( #[ $( $attr: meta) * ] ) * impl Satisfier <Pk > for $map: ident<$key: ty, $val: ty>) => {
244
+ $( #[ $( $attr) * ] ) *
245
+ impl <Pk : MiniscriptKey + ToPublicKey > Satisfier <Pk >
246
+ for $map<( hash160:: Hash , TapLeafHash ) , ( Pk , bitcoin:: taproot:: Signature ) >
247
+ where
248
+ Pk : MiniscriptKey + ToPublicKey ,
249
+ {
250
+ fn lookup_tap_leaf_script_sig(
251
+ & self ,
252
+ key: & Pk ,
253
+ h: & TapLeafHash ,
254
+ ) -> Option <bitcoin:: taproot:: Signature > {
255
+ self . get( & ( key. to_pubkeyhash( SigType :: Schnorr ) , * h) )
256
+ . map( |x| x. 1 )
257
+ }
255
258
256
- fn lookup_raw_pkh_tap_leaf_script_sig (
257
- & self ,
258
- pk_hash : & ( hash160:: Hash , TapLeafHash ) ,
259
- ) -> Option < ( XOnlyPublicKey , bitcoin:: taproot:: Signature ) > {
260
- self . get ( pk_hash)
261
- . map ( |& ( ref pk, sig) | ( pk. to_x_only_pubkey ( ) , sig) )
262
- }
259
+ fn lookup_raw_pkh_tap_leaf_script_sig(
260
+ & self ,
261
+ pk_hash: & ( hash160:: Hash , TapLeafHash ) ,
262
+ ) -> Option <( XOnlyPublicKey , bitcoin:: taproot:: Signature ) > {
263
+ self . get( pk_hash)
264
+ . map( |& ( ref pk, sig) | ( pk. to_x_only_pubkey( ) , sig) )
265
+ }
266
+ }
267
+ } ;
268
+ }
269
+
270
+ impl_satisfier_for_map_hash_tapleafhash_to_key_taproot_sig ! {
271
+ impl Satisfier <Pk > for BTreeMap <( hash160:: Hash , TapLeafHash ) , ( Pk , bitcoin:: taproot:: Signature ) >
272
+ }
273
+
274
+ impl_satisfier_for_map_hash_tapleafhash_to_key_taproot_sig ! {
275
+ impl Satisfier <Pk > for HashMap <( hash160:: Hash , TapLeafHash ) , ( Pk , bitcoin:: taproot:: Signature ) >
263
276
}
264
277
265
278
impl < ' a , Pk : MiniscriptKey + ToPublicKey , S : Satisfier < Pk > > Satisfier < Pk > for & ' a S {
0 commit comments