rust-bitcoin-unsafe-fast/bitcoin/src
merge-script 4ca6cd6065
Merge rust-bitcoin/rust-bitcoin#4458: locktimes: replace `MtpAndHeight` type with pair of `BlockMtp` and `BlockHeight`
47c77afaac units: delete MtpAndHeight type (Andrew Poelstra)
d82b8c0bcb primitives: stop using MtpAndHeight (Andrew Poelstra)
72d5fbad73 units: stop using MtpAndHeight in locktime::relative is_satisfied_by methods (Andrew Poelstra)
d933c754f5 units: change type of MtpHeight::to_mtp to BlockMtp (Andrew Poelstra)
dcbdb7ca8a units: add checked arithmetic to Block{Height,Mtp}{Interval,} (Andrew Poelstra)
4300271f0c units: add constructor for absolute::Mtp from timestamps (Andrew Poelstra)
4e4601b3d5 units: rename BlockInterval to BlockHeightInterval (Andrew Poelstra)
cb882c5ce1 units: add global `BlockMtpInterval` type (Andrew Poelstra)
4e3af5162f units: add global `BlockMtp` type (Andrew Poelstra)
a3228d4636 units: pull u32 conversions for BlockHeight/BlockInterval into macro (Andrew Poelstra)

Pull request description:

  This is a more involved PR than I'd expected but hopefully the individual commits make sense and are well-motivated. Essentially, my goal was to replace `MtpAndHeight` as used by relative locktimes with a pair of `Mtp` and `Height`.

  However, relative locktimes, when given a MTP/Height for the UTXO creation and the chain tip, are roughly modeled as "take a diff of MTPs to get a `relative::MtpInterval`, a diff of heights to get a `relative::HeightInterval`, and compare to the locktimes". *However*, we have no standalone MTP type to "take a diff of", and also there are failure modes when creating the diffs (e.g. if the diff would exceed the range of `MtpInterval` or `HeightInterval`).

  So I backed up and decided to use the existing `BlockHeight`/`BlockInterval` as the type to "take a diff of". I needed to introduce a `BlockMtp`/`BlockMtpInterval` to work with MTPs. These types have full-u32 range, unlike the similarly-named types in `units::locktimes::absolute`. I then needed to add some conversion methods. Along the way, I cleaned up the APIs and documentation, added checked arithmetic, etc., as needed.

  See the individual commit messages for more detail.

  I believe the resulting API is much more consistent and discoverable, even though it has more surface than the old API.

  I considered splitting this into 2 PRs but I think the first half of the changes aren't well-motivated with out the second half. Let me know.

ACKs for top commit:
  tcharding:
    ACK 47c77afaac

Tree-SHA512: ebe19a5b1684db8c2d913274347c994026aaa0dcdd79349c237920a82fe55560777278efdbbc7f1b1424c9391d9bbd891ae844db885deea75288000437a8a287
2025-05-07 22:32:16 +00:00
..
address Merge rust-bitcoin/rust-bitcoin#4410: Wrap secp256k1::XOnlyPublicKey to improve error handling 2025-05-07 17:01:31 +00:00
blockdata Merge rust-bitcoin/rust-bitcoin#4458: locktimes: replace `MtpAndHeight` type with pair of `BlockMtp` and `BlockHeight` 2025-05-07 22:32:16 +00:00
consensus Use a consistent rustdoc heading level of H1 `#` 2025-04-22 13:06:32 +01:00
crypto Merge rust-bitcoin/rust-bitcoin#4410: Wrap secp256k1::XOnlyPublicKey to improve error handling 2025-05-07 17:01:31 +00:00
merkle_tree 2025-04-27 automated rustfmt nightly 2025-04-27 01:36:56 +00:00
network units: rename BlockInterval to BlockHeightInterval 2025-05-06 15:50:43 +00:00
p2p bitcoin: remove torv2 support 2025-05-05 15:27:35 -03:00
psbt Merge rust-bitcoin/rust-bitcoin#4410: Wrap secp256k1::XOnlyPublicKey to improve error handling 2025-05-07 17:01:31 +00:00
taproot Merge rust-bitcoin/rust-bitcoin#4410: Wrap secp256k1::XOnlyPublicKey to improve error handling 2025-05-07 17:01:31 +00:00
bip32.rs Merge rust-bitcoin/rust-bitcoin#4410: Wrap secp256k1::XOnlyPublicKey to improve error handling 2025-05-07 17:01:31 +00:00
bip152.rs chore: Fix the typos in the comments and variables 2025-04-15 18:31:52 +08:00
bip158.rs Merge rust-bitcoin/rust-bitcoin#4250: Introduce and use `test_hex_unwrap` macro in `internals` 2025-04-24 17:19:37 +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 Update internal_macros.rs 2025-04-24 16:46:01 +03:00
lib.rs Merge rust-bitcoin/rust-bitcoin#4458: locktimes: replace `MtpAndHeight` type with pair of `BlockMtp` and `BlockHeight` 2025-05-07 22:32:16 +00:00
policy.rs Policy: Relax MIN_STANDARD_TX_NONWITNESS_SIZE to 65 2025-02-27 00:20:08 +07:00
pow.rs fix error pow.rs 2025-04-25 10:56:28 +02: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