@@ -79,32 +79,33 @@ impl<Pk: MiniscriptKey> Wsh<Pk> {
79
79
}
80
80
81
81
impl < Pk : MiniscriptKey + ToPublicKey > Wsh < Pk > {
82
- /// Obtain the corresponding script pubkey for this descriptor
83
- /// Non failing verion of [`DescriptorTrait::script_pubkey`] for this descriptor
82
+ /// Obtains the corresponding script pubkey for this descriptor.
83
+ /// Called by [`DescriptorTrait::script_pubkey`] for this descriptor.
84
84
pub fn spk ( & self ) -> Script {
85
85
self . inner_script ( ) . to_v0_p2wsh ( )
86
86
}
87
87
88
- /// Obtain the corresponding script pubkey for this descriptor
89
- /// Non failing verion of [`DescriptorTrait::address`] for this descriptor
88
+ /// Obtains the corresponding script pubkey for this descriptor.
89
+ /// Called by [`DescriptorTrait::address`] for this descriptor.
90
90
pub fn addr ( & self , network : Network ) -> Address {
91
91
match self . inner {
92
92
WshInner :: SortedMulti ( ref smv) => Address :: p2wsh ( & smv. encode ( ) , network) ,
93
93
WshInner :: Ms ( ref ms) => Address :: p2wsh ( & ms. encode ( ) , network) ,
94
94
}
95
95
}
96
96
97
- /// Obtain the underlying miniscript for this descriptor
98
- /// Non failing verion of [`DescriptorTrait::explicit_script`] for this descriptor
97
+ /// Obtains the underlying miniscript for this descriptor.
98
+ /// Called by [`DescriptorTrait::explicit_script`] for this descriptor.
99
99
pub fn inner_script ( & self ) -> Script {
100
100
match self . inner {
101
101
WshInner :: SortedMulti ( ref smv) => smv. encode ( ) ,
102
102
WshInner :: Ms ( ref ms) => ms. encode ( ) ,
103
103
}
104
104
}
105
105
106
- /// Obtain the pre bip-340 signature script code for this descriptor
107
- /// Non failing verion of [`DescriptorTrait::script_code`] for this descriptor
106
+ /// Obtains the pre bip-340 signature script code for this descriptor.
107
+ /// Called by [`DescriptorTrait::script_code`] for this descriptor.
108
+ /// Equivalent to `self.inner_script`.
108
109
pub fn ecdsa_sighash_script_code ( & self ) -> Script {
109
110
self . inner_script ( )
110
111
}
@@ -359,28 +360,29 @@ impl<Pk: MiniscriptKey> Wpkh<Pk> {
359
360
}
360
361
361
362
impl < Pk : MiniscriptKey + ToPublicKey > Wpkh < Pk > {
362
- /// Obtain the corresponding script pubkey for this descriptor
363
- /// Non failing verion of [`DescriptorTrait::script_pubkey`] for this descriptor
363
+ /// Obtains the corresponding script pubkey for this descriptor.
364
+ /// Called by [`DescriptorTrait::script_pubkey`] for this descriptor.
364
365
pub fn spk ( & self ) -> Script {
365
366
let addr = Address :: p2wpkh ( & self . pk . to_public_key ( ) , Network :: Bitcoin )
366
367
. expect ( "wpkh descriptors have compressed keys" ) ;
367
368
addr. script_pubkey ( )
368
369
}
369
370
370
- /// Obtain the corresponding script pubkey for this descriptor
371
- /// Non failing verion of [`DescriptorTrait::address`] for this descriptor
371
+ /// Obtains the [`Address`] for this descriptor.
372
372
pub fn addr ( & self , network : Network ) -> Address {
373
- Address :: p2wpkh ( & self . pk . to_public_key ( ) , network)
373
+ bitcoin :: Address :: p2wpkh ( & self . pk . to_public_key ( ) , network)
374
374
. expect ( "Rust Miniscript types don't allow uncompressed pks in segwit descriptors" )
375
375
}
376
376
377
- /// Obtain the underlying miniscript for this descriptor
378
- /// Non failing verion of [`DescriptorTrait::explicit_script`] for this descriptor
377
+ /// Obtains the underlying miniscript for this descriptor.
378
+ /// Called by [`DescriptorTrait::explicit_script`] for this descriptor.
379
+ /// Equivalent to [`DescriptorTrait::script_pubkey`] for this descriptor.
379
380
pub fn inner_script ( & self ) -> Script {
380
381
self . spk ( )
381
382
}
382
383
383
384
/// Obtains the pre bip-340 signature script code for this descriptor.
385
+ /// Called by [`DescriptorTrait::script_code`] for this descriptor.
384
386
pub fn ecdsa_sighash_script_code ( & self ) -> Script {
385
387
// For SegWit outputs, it is defined by bip-0143 (quoted below) and is different from
386
388
// the previous txo's scriptPubKey.
0 commit comments