rust-bitcoin-unsafe-fast/bitcoin/src
Martin Habovstiak 5dd0c9253d Remove a bunch of `try_into().expect()`
Previously we've used `try_into().expect()` because const generics were
unavailable. Then they became available but we didn't realize we could
already convert a bunch of code to not use panicking conversions. But we
can (and could for a while).

This adds an extension trait for arrays to provide basic non-panicking
operations returning arrays, so they can be composed with other
functions accepting arrays without any conversions. It also refactors a
bunch of code to use the non-panicking constructs but it's certainly not
all of it. That could be done later. This just aims at removing the
ugliest offenders and demonstrate the usefulness of this approach.

Aside from this, to avoid a bunch of duplicated work, this refactors
BIP32 key parsing to use a common method where xpub and xpriv are
encoded the same. Not doing this already led to a mistake where xpriv
implemented some additional checks that were missing in xpub. Thus this
change also indirectly fixes that bug.
2025-03-20 20:19:50 +01:00
..
address Remove a bunch of `try_into().expect()` 2025-03-20 20:19:50 +01:00
blockdata Merge rust-bitcoin/rust-bitcoin#4248: Alloc-free (AKA zero-copy) control block 2025-03-20 19:12:00 +00:00
consensus fix typos 2025-03-10 09:04:59 +08:00
crypto Remove a bunch of `try_into().expect()` 2025-03-20 20:19:50 +01: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 test: add coverage for ServiceFlags::P2P_V2 2025-03-11 18:24:16 -03:00
psbt Remove a bunch of `try_into().expect()` 2025-03-20 20:19:50 +01:00
taproot Remove a bunch of `try_into().expect()` 2025-03-20 20:19:50 +01:00
bip32.rs Remove a bunch of `try_into().expect()` 2025-03-20 20:19:50 +01:00
bip152.rs Remove a bunch of `try_into().expect()` 2025-03-20 20:19:50 +01:00
bip158.rs Remove a bunch of `try_into().expect()` 2025-03-20 20:19:50 +01:00
consensus_validation.rs Stop using FQP on Amount type 2025-01-24 08:54:24 +11:00
hash_types.rs bitcoin: Remove hash type re-exports 2025-03-04 08:15:04 +11:00
internal_macros.rs Set avoid-breaking-exported-api to false 2024-12-11 10:11:50 +11:00
lib.rs Remove a bunch of `try_into().expect()` 2025-03-20 20:19:50 +01: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