From ffd0ae662a9dfab6310b32a0d3b28585e229f73b Mon Sep 17 00:00:00 2001 From: Jean-Pierre De Jesus DIAZ Date: Mon, 13 Nov 2023 13:04:21 +0100 Subject: [PATCH] fixup! SFT-UNKN: Add foundation-bip32 crate. --- bip32/src/parser.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/bip32/src/parser.rs b/bip32/src/parser.rs index 0a2b2cf..8816548 100644 --- a/bip32/src/parser.rs +++ b/bip32/src/parser.rs @@ -91,10 +91,9 @@ where Error: ParseError, Error: FromExternalError, { - let depth = u8::; - let parent_fingerprint = fingerprint::; - let child_number = be_u32::; - let chain_code = map(take::<_, Input, Error>(32usize), to_fixed_bytes::<_, 32>); + let depth = u8; + let parent_fingerprint = fingerprint; + let child_number = be_u32; let public_key = map_res( map(take::<_, Input, Error>(33usize), to_fixed_bytes::<_, 33>), |pk| PublicKey::from_slice(&pk), @@ -162,6 +161,17 @@ where Ok((i, Fingerprint(buf))) } +/// Parses a BIP-32 chain code. +pub fn chain_code(i: Input) -> IResult +where + Input: PartialEq + Clone + Slice> + InputIter + InputLength, + Error: ParseError, +{ + let mut buf = [0; 32]; + let (i, ()) = fill(u8, &mut buf)(i)?; + Ok((i, buf)) +} + /// Parses a [`KeySource`]. pub fn key_source(i: Input) -> IResult, Error> where