zcash_primitives: Improve ZIP 32 comments

This commit is contained in:
Jack Grigg 2023-11-27 23:41:23 +00:00
parent f7726141c3
commit 7064efe697
2 changed files with 4 additions and 1 deletions

View File

@ -350,7 +350,7 @@ impl ExtendedSpendingKey {
})
}
/// Reads and decodes the encoded form of the extended spending key as define in
/// Reads and decodes the encoded form of the extended spending key as defined in
/// [ZIP 32](https://zips.z.cash/zip-0032) from the provided reader.
pub fn read<R: Read>(mut reader: R) -> io::Result<Self> {
let depth = reader.read_u8()?;

View File

@ -55,6 +55,9 @@ impl ConditionallySelectable for AccountId {
pub struct ChildIndex(u32);
impl ChildIndex {
/// Parses the given ZIP 32 child index.
///
/// Returns `None` if the hardened bit is not set.
pub fn from_index(i: u32) -> Option<Self> {
if i >= (1 << 31) {
Some(ChildIndex(i))