You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ChildNumber enum maintains the invariant that each value does not have the top bit set. In other words the inner values of ChildNumber::Hardened and ChildNumber::Normal do not use the top bit. The from_hardened_idx and from_normal_idx expect the input value to not use the top bit (to be within the range [0, 2^31 - 1]). There is also the From<u32> impl that accepts a u32 with the top bit specifying hardened/normal
implFrom<u32>forChildNumber{fnfrom(number:u32) -> Self{if number &(1 << 31) != 0{ChildNumber::Hardened{index: number ^ (1 << 31)}}else{ChildNumber::Normal{index: number }}}}
In https://github.com/rust-bitcoin/rust-bitcoin/blob/master/bitcoin/src/bip32.rs#L149, I see that the if check is as same as the from_normal_idx. Shouldn't the implementation like this:
The text was updated successfully, but these errors were encountered: