File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ use std::{
3131} ;
3232
3333use bitcoin:: blockdata:: witness:: Witness ;
34+ use bitcoin:: util:: address:: WitnessVersion ;
3435use bitcoin:: { self , secp256k1, Script } ;
3536
3637use self :: checksum:: verify_checksum;
@@ -263,12 +264,14 @@ pub enum DescriptorType {
263264impl DescriptorType {
264265 /// Returns the segwit version implied by the descriptor type.
265266 ///
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 > {
268269 use self :: DescriptorType :: * ;
269270 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+ }
272275 Bare | Sh | Pkh | ShSortedMulti => None ,
273276 }
274277 }
You can’t perform that action at this time.
0 commit comments