Making ExtendedPubKey decode aligned with ExtendedPrivKey variant
This commit is contained in:
parent
a802ca88ef
commit
fa4ecb4a6a
|
@ -650,9 +650,6 @@ impl ExtendedPubKey {
|
||||||
return Err(Error::WrongExtendedKeyLength(data.len()))
|
return Err(Error::WrongExtendedKeyLength(data.len()))
|
||||||
}
|
}
|
||||||
|
|
||||||
let cn_int: u32 = endian::slice_to_u32_be(&data[9..13]);
|
|
||||||
let child_number: ChildNumber = ChildNumber::from(cn_int);
|
|
||||||
|
|
||||||
Ok(ExtendedPubKey {
|
Ok(ExtendedPubKey {
|
||||||
network: if data[0..4] == [0x04u8, 0x88, 0xB2, 0x1E] {
|
network: if data[0..4] == [0x04u8, 0x88, 0xB2, 0x1E] {
|
||||||
Network::Bitcoin
|
Network::Bitcoin
|
||||||
|
@ -665,10 +662,9 @@ impl ExtendedPubKey {
|
||||||
},
|
},
|
||||||
depth: data[4],
|
depth: data[4],
|
||||||
parent_fingerprint: Fingerprint::from(&data[5..9]),
|
parent_fingerprint: Fingerprint::from(&data[5..9]),
|
||||||
child_number: child_number,
|
child_number: endian::slice_to_u32_be(&data[9..13]).into(),
|
||||||
chain_code: ChainCode::from(&data[13..45]),
|
chain_code: ChainCode::from(&data[13..45]),
|
||||||
public_key: PublicKey::from_slice(
|
public_key: PublicKey::from_slice(&data[45..78])?,
|
||||||
&data[45..78])?,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue