rust-bitcoin-unsafe-fast/bitcoin/src
Andrew Poelstra a66ad97fb6
bip32: split InvalidChildNumber and InvalidChildNumberFormat out of error
Currently in this module we have a distinction between an "index" which
is a number between [0, 2^31 - 1] which indexes into the set of normal
or hardened child numbers. We also have a child *number*, which within
the library is an opaque type, but can be freely converted into/out of a
u32 in the consensus encoding which uses the MSB as a normal/hardened
flag and the other bits to encode the index.

Probably we want to change ChildNumber::From<u32> to some sort of
from_consensus_u32 method, but that's out of scope for this PR. What is
*in scope*, though is fixing the error types.

In the existing code we have three problems:

* Our error type for a bad index is called InvalidChildNumber, rather
  than InvalidIndex, and the error message reflects this, which is wrong
  and confusing. (Some with InvalidChildNumberFormat.)
* The InvalidChildNumberFormat is always constructed from a ParseIntError
  from stdlib, but we always throw that away rather than preserving it.
* These two error variants only appear when parsing child numbers, or
  derivation paths which are lists of child numbers, but they are part
  of the main error enum.
2025-04-22 14:46:34 +00:00
..
address Capitalize Taproot in rustdocs 2025-04-17 18:02:35 +01:00
blockdata Merge rust-bitcoin/rust-bitcoin#4368: test: add test for push slice minimal 2025-04-21 14:54:24 +00:00
consensus fix typos 2025-03-10 09:04:59 +08:00
crypto 2025-03-30 automated rustfmt nightly 2025-03-30 01:27:51 +00:00
merkle_tree 2025-01-12 automated rustfmt nightly 2025-01-12 01:23:13 +00:00
network Update CompactTarget::from_next_work_required to take timespan as i64 2024-11-27 11:27:22 -06:00
p2p fix rejectection to rejection message_network.rs 2025-04-17 21:13:12 +02:00
psbt bip32: make Xpriv::new_master be infallible 2025-04-22 14:45:36 +00:00
taproot Merge rust-bitcoin/rust-bitcoin#4375: Add ControlBlock constructor that takes a hex string 2025-04-21 16:57:41 +00:00
bip32.rs bip32: split InvalidChildNumber and InvalidChildNumberFormat out of error 2025-04-22 14:46:34 +00:00
bip152.rs chore: Fix the typos in the comments and variables 2025-04-15 18:31:52 +08:00
bip158.rs 2025-03-30 automated rustfmt nightly 2025-03-30 01:27:51 +00:00
consensus_validation.rs Stop using FQP on Amount type 2025-01-24 08:54:24 +11:00
hash_types.rs 2025-03-30 automated rustfmt nightly 2025-03-30 01:27:51 +00:00
internal_macros.rs Set avoid-breaking-exported-api to false 2024-12-11 10:11:50 +11:00
lib.rs Merge rust-bitcoin/rust-bitcoin#4166: Remove bip158 types from crate root 2025-03-26 15:06:55 +00:00
policy.rs Policy: Relax MIN_STANDARD_TX_NONWITNESS_SIZE to 65 2025-02-27 00:20:08 +07:00
pow.rs chore: spellchecker 2025-03-16 07:23:18 +00:00
serde_utils.rs Elide more lifetimes 2024-10-28 15:22:13 +11:00
sign_message.rs update secp256k1 to 0.30.0 2025-03-02 23:31:48 +08:00