File tree 1 file changed +7
-4
lines changed 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ use std::{
31
31
} ;
32
32
33
33
use bitcoin:: blockdata:: witness:: Witness ;
34
+ use bitcoin:: util:: address:: WitnessVersion ;
34
35
use bitcoin:: { self , secp256k1, Script } ;
35
36
36
37
use self :: checksum:: verify_checksum;
@@ -263,12 +264,14 @@ pub enum DescriptorType {
263
264
impl DescriptorType {
264
265
/// Returns the segwit version implied by the descriptor type.
265
266
///
266
- /// This will return `Some(0 )` whether it is "native" segwitv0 or "wrapped" p2sh segwit.
267
- pub fn segwit_version ( & self ) -> Option < u8 > {
267
+ /// This will return `Some(WitnessVersion::V0 )` whether it is "native" segwitv0 or "wrapped" p2sh segwit.
268
+ pub fn segwit_version ( & self ) -> Option < WitnessVersion > {
268
269
use self :: DescriptorType :: * ;
269
270
match self {
270
- Tr => Some ( 1 ) ,
271
- Wpkh | ShWpkh | Wsh | ShWsh | ShWshSortedMulti | WshSortedMulti => Some ( 0 ) ,
271
+ Tr => Some ( WitnessVersion :: V1 ) ,
272
+ Wpkh | ShWpkh | Wsh | ShWsh | ShWshSortedMulti | WshSortedMulti => {
273
+ Some ( WitnessVersion :: V0 )
274
+ }
272
275
Bare | Sh | Pkh | ShSortedMulti => None ,
273
276
}
274
277
}
You can’t perform that action at this time.
0 commit comments