File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -345,7 +345,7 @@ impl fmt::Display for ConversionError {
345
345
impl error:: Error for ConversionError { }
346
346
347
347
impl DescriptorPublicKey {
348
- /// The fingerprint of the master key associated with this key
348
+ /// The fingerprint of the master key associated with this key, `0x00000000` if none.
349
349
pub fn master_fingerprint ( & self ) -> bip32:: Fingerprint {
350
350
match * self {
351
351
DescriptorPublicKey :: XPub ( ref xpub) => {
@@ -364,7 +364,7 @@ impl DescriptorPublicKey {
364
364
. key
365
365
. write_into ( & mut engine)
366
366
. expect ( "engines don't error" ) ;
367
- bip32:: Fingerprint :: from ( & XpubIdentifier :: from_engine ( engine) [ ..] )
367
+ bip32:: Fingerprint :: from ( & XpubIdentifier :: from_engine ( engine) [ ..4 ] )
368
368
}
369
369
}
370
370
}
@@ -824,4 +824,17 @@ mod test {
824
824
"m/90'/0'/1'/2"
825
825
) ;
826
826
}
827
+
828
+ #[ test]
829
+ fn test_master_fingerprint ( ) {
830
+ assert_eq ! (
831
+ DescriptorPublicKey :: from_str(
832
+ "02a489e0ea42b56148d212d325b7c67c6460483ff931c303ea311edfef667c8f35" ,
833
+ )
834
+ . unwrap( )
835
+ . master_fingerprint( )
836
+ . as_bytes( ) ,
837
+ b"\xb0 \x59 \x11 \x6a "
838
+ ) ;
839
+ }
827
840
}
You can’t perform that action at this time.
0 commit comments