rust-bitcoin-unsafe-fast/bitcoin/src
merge-script 0ca9fcfd0e
Merge rust-bitcoin/rust-bitcoin#4157: Enforce MAX_MONEY invariant in amount types
ab4ea7c13d Enforce the MAX_MONEY invariant in amount types (Tobin C. Harding)

Pull request description:

  Enforcing the `MAX_MONEY` invariant is quite involved because it means multiple things:

  - Constructing amounts is now fallible
  - Converting from unsigned to signed is now infallible
  - Taking the absolute value is now infallible
  - Integer overflow is eliminated in various places

  Details:
  - Update `from_sat` to check the invariant
  - Fix all docs including examples
  - Use the unchecked constructor in test code
  - Comment any other use of the unchecked constructor
  - Deprecate `unchecked_abs`
  - Fail serde (using the horrible string error variant)
  - Try not to use the unchecked constructor in rustdocs, no need to encourage unsuspecting users to use it.
  - Use `?` in rustdoc examples (required by Rust API guidlines)
  - Remove `TryFrom<Amount> for SignedAmount` because the conversion is now infallible. Add a `From` impl.
  - Fix the arbitrary impls
  - Maintain correct formatting
  - Remove private `check_max` function as its no longer needed

  Close #620

ACKs for top commit:
  apoelstra:
    ACK ab4ea7c13d08411044bd5f9c17457e926c80ed4d; successfully ran local tests

Tree-SHA512: bec963d8ea69e202f399cd19bca864b06f3e86323d376c2d2126d74093598f8bbbf19792b2327dba0862ef6f0201202778014a2be7a14991f02917d8ca312afb
2025-03-13 23:35:40 +00:00
..
address chore: add missing backquotes 2025-03-12 16:51:55 +08:00
blockdata Merge rust-bitcoin/rust-bitcoin#4157: Enforce MAX_MONEY invariant in amount types 2025-03-13 23:35:40 +00:00
consensus fix typos 2025-03-10 09:04:59 +08:00
crypto Fix some comments 2025-03-07 17:03:58 +08: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 Enforce the MAX_MONEY invariant in amount types 2025-03-13 09:07:14 +11:00
taproot Replace underflow with overflow in doc comments 2025-03-08 10:41:20 -06:00
bip32.rs Add validation for private key format and master key constraints 2025-03-10 10:22:41 -03:00
bip152.rs Re-name Timestamp to BlockTime 2025-03-08 08:28:46 +11:00
bip158.rs 2025-01-12 automated rustfmt nightly 2025-01-12 01:23:13 +00: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 Merge rust-bitcoin/rust-bitcoin#4157: Enforce MAX_MONEY invariant in amount types 2025-03-13 23:35:40 +00:00
policy.rs Policy: Relax MIN_STANDARD_TX_NONWITNESS_SIZE to 65 2025-02-27 00:20:08 +07:00
pow.rs Re-name Timestamp to BlockTime 2025-03-08 08:28:46 +11: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