Commit Graph

6596 Commits

Author SHA1 Message Date
Tobin C. Harding b38d2256fd
Run the formatter 2025-05-08 09:46:52 +10:00
merge-script 41f26cf090
Merge rust-bitcoin/rust-bitcoin#4418: docs: correction comments in `check-semver-feature.sh`
a91e4de08c correction comments check-semver-feature.sh (Alex Pikme)

Pull request description:

  `presence non-additive` -` presence of non-additive `-- **add of**
  `non-addivite` - `non-additive` -- **fix error**

ACKs for top commit:
  apoelstra:
    ACK a91e4de08c6b34d438d47390b1747aaf242cd7e3; successfully ran local tests
  tcharding:
    ACK a91e4de08c

Tree-SHA512: d179d2cf8e076d0b2143145d86135a992e66f62d30b777fd50d2d3bb2026e738f6e0d61423ba84d4c7b7dc62f881ec6f8dad2d9bcc5ea7e1289e47e962ad3c40
2025-05-07 23:09:48 +00:00
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
merge-script 8a563efb02
Merge rust-bitcoin/rust-bitcoin#4460: fix duplicate poly1305.rs
f36b8f22d9 fix duplicate poly1305.rs (futreall)

Pull request description:

  hi devs
  fixed error `and and`

ACKs for top commit:
  tcharding:
    ACK f36b8f22d9

Tree-SHA512: 65669ebcd289e2431fe2126ad8256fdc79f2c3afc2bdff4ded968f453bd865feb82488ba9ab2ec1678b1d9b9c6947e82e61848d8f445d0558eb24a51cad76a4d
2025-05-07 21:51:10 +00:00
merge-script dc277321c7
Merge rust-bitcoin/rust-bitcoin#4455: just: Add update-lock-files alias
3fa7889ff7 just: Add update-lock-files alias (Tobin C. Harding)

Pull request description:

  More terse more betterer - `just ulf` already.

ACKs for top commit:
  apoelstra:
    ACK 3fa7889ff7920b2458df40266fb3d4f32ca72c77; successfully ran local tests; sure

Tree-SHA512: 9445fbf4dd54a95a55907b8f1a6099876251de57a29395f563628ce0e0b55cf04041f0a616370fd655f01ba8ec5a7e2c1db12e0570dcf4ab342f65104c2c2718
2025-05-07 20:41:02 +00:00
merge-script 884dc5e103
Merge rust-bitcoin/rust-bitcoin#4428: Use NumOpResult instead of Option
13cbead947 Use NumOpResult instead of Option (yancy)
002a0382aa Mark function constant (yancy)

Pull request description:

  Prefer the more descriptive NumOpResult return type over Option where return types are fallible.

  Closes https://github.com/rust-bitcoin/rust-bitcoin/issues/4419

ACKs for top commit:
  apoelstra:
    ACK 13cbead94766987f59482b1fbc1d0ebd0799737c; successfully ran local tests
  tcharding:
    ACK 13cbead947
  Kixunil:
    ACK 13cbead947

Tree-SHA512: 1a870962dcafe901a07abd93bd8075e41696341c1a4b3efef615493c73d5e5728bbc2326f8c2c95b9034ab001d0b3c668c9d64793ab03486d3a19f31df907c96
2025-05-07 20:04:16 +00:00
merge-script 10657865c3
Merge rust-bitcoin/rust-bitcoin#4457: rustdoc: Fix unused lint warnings
52940d4e12 Prefix unused variables with _ in rustdocs (Jamil Lambert, PhD)
a852aef4b8 Remove unused imports in rustdocs (Jamil Lambert, PhD)

Pull request description:

  There is a lint warning about unused variables and imports in the rustdoc examples.

  Remove the unused imports and prefix the unused variables with an underscore.

ACKs for top commit:
  apoelstra:
    ACK 52940d4e1216ad5118f7980cb2e6b8b425c61589; successfully ran local tests
  tcharding:
    ACK 52940d4e12

Tree-SHA512: 953862d546dc6e0bcd64172e8b383f0fc2a1a851971a1bcad0c1e30cbaeeaea993a0de7dd8b424c4ac1410053e179c52d0b5c90cd1b6560c27123b6b7fa49732
2025-05-07 18:56:53 +00:00
merge-script 7d4b40dfd4
Merge rust-bitcoin/rust-bitcoin#4410: Wrap secp256k1::XOnlyPublicKey to improve error handling
c11772a768 Accept flexible input types for Taproot-related functions (Erick Cestari)
2a518d62e6 Wrap secp256k1::XOnlyPublicKey to improve error handling (Erick Cestari)

Pull request description:

  This PR addresses issue #4361 by creating a wrapper type for XOnlyPublicKey instead of directly re-exporting it from the secp256k1 library.

  ### Key Changes

  1. Created a new `XOnlyPublicKey` struct that wraps `secp256k1::XOnlyPublicKey`
  2. Implemented custom error types:
      - `ParseXOnlyPublicKeyError` for handling parsing errors
      - `TweakXOnlyPublicKeyError` for tweaking an `XOnlyPublicKey`
  3. Updated all imports and usage throughout the codebase
  4. Implemented necessary traits and methods for compatibility

  Closes #4361

ACKs for top commit:
  apoelstra:
    ACK c11772a768eefd89dcc0e3b1a369d535c191f94a; successfully ran local tests
  tcharding:
    ACK c11772a768

Tree-SHA512: c8da3486e7ffcab6c24cc08f9b2f964dd9158449ef2bd720e54d56176bc7027052314ea23cac3f673d217fa785238ea8a9b5323ba57f02199f20e56df5893965
2025-05-07 17:01:31 +00:00
merge-script f1418bcafa
Merge rust-bitcoin/rust-bitcoin#4456: Fix documentation error for `TweakedPublicKey::serialize`
7ecef176f9 Fix documentation error for `TweakedPublicKey::serialize` (Daniel Roberts)

Pull request description:

  Fixes an ancient copy/paste error in documentation ( `secp256k1::schnorrsig::PublicKey::serialize()` docs copied from ECDSA docs, which was copied into rust-bitcoin)

  Is there a threshold beneath which a PR is too trivial?

ACKs for top commit:
  apoelstra:
    ACK 7ecef176f9523cd8fece7e8e71040507f46fb9c2; successfully ran local tests; thanks!
  tcharding:
    ACK 7ecef176f9

Tree-SHA512: 9b7469d34eadfcabc93264c114f292c415d2dbb09b41ec05de4ac399677d5c80f1d09ecd0c382680996450824f1fd60503d3e3d3ec8bdd8135cebdf7ef82fe0d
2025-05-07 16:04:16 +00:00
merge-script 6adf952b0b
Merge rust-bitcoin/rust-bitcoin#4409: Manual update to rustc (to nightly-2025-05-02)
5ba763f1a2 Update Github CI to rustc nightly-2025-05-02 (Jamil Lambert, PhD)
09132b80e1 Fix rustdoc compile_fail example (Jamil Lambert, PhD)
282434d4bd Use variable directly in format! string (Jamil Lambert, PhD)
2fbbc825c9 Allow uninlined format args (Jamil Lambert, PhD)

Pull request description:

  There is a new lint error on nightly-2025-04-25 "variables can be used directly in the `format!` string".
  The existing syntax `format!("{}", x)` is more commonly used than `format!("{x}")` therefore allow it in existing code.

  Also the rustdoc example in #4259 now causes the new nightly to fail CI because of the unused variable.

  Patches in the PR:

  - Exclude the lint to allow the existing syntax in `format!` strings in all crate `lib.rs`, `build.rs.` and test files.

  - Use the variables in the `format!` string for all cases in `bitcoin/examples/` since there are no other allowed lints in examples.

  - Correct the function names in the rustdoc example and prefix the unused variable with an underscore.

  - Update rustc to nightly-2025-05-02 (2025-04-25 had a bug which is fixed in 2025-05-02).

ACKs for top commit:
  apoelstra:
    ACK 5ba763f1a2ebea2cb80ee50a80228e6bda11936f; successfully ran local tests
  Kixunil:
    ACK 5ba763f1a2

Tree-SHA512: 20b97d2bedc631715c2b541285559a6ab84bbdb8f2f11d7282bdfecadba0cc8781a1973f0c01c25432aaceaad09e3ddbf59afe54c0bba54768e93ed9d5e50d5a
2025-05-07 14:13:07 +00:00
merge-script 3b57bd1ea9
Merge rust-bitcoin/rust-bitcoin#4451: Set deprecation to released date of to_inner
51fe619fe0 Set deprecation to released date of to_inner (Tobin C. Harding)

Pull request description:

  In #4373 we added a couple new conversion methods and deprecated the `to_inner` ones. During that the deprecation date was set to `0.33.0`.

  We have backported the changes and will deprecate in `0.32.6` so set the version number now so we don't forget later.

ACKs for top commit:
  apoelstra:
    ACK 51fe619fe0c9e154a7979a3a71c56707bfa73e9c; successfully ran local tests
  shinghim:
    ACK 51fe619fe0

Tree-SHA512: 9f8badee92684204966107013b272ff51b88bee632bd6779ec6ecf2c78221c2228428a3c180200db5ae3205d042e58a6919dc9e621e153171e200e9b81c628d6
2025-05-07 13:28:56 +00:00
futreall f36b8f22d9
fix duplicate poly1305.rs 2025-05-07 12:57:11 +03:00
Andrew Poelstra 47c77afaac
units: delete MtpAndHeight type
This type provides little value beyond just pairing a BlockHeight and a
BlockMtp.
2025-05-06 19:23:31 +00:00
Andrew Poelstra d82b8c0bcb
primitives: stop using MtpAndHeight 2025-05-06 19:23:17 +00:00
Andrew Poelstra 72d5fbad73
units: stop using MtpAndHeight in locktime::relative is_satisfied_by methods
Keep using it in primitives; will remove it there in the next commit.
2025-05-06 18:51:03 +00:00
Andrew Poelstra d933c754f5
units: change type of MtpHeight::to_mtp to BlockMtp
We are going to delete MtpHeight in a couple commits, but to let us do
the transition with smaller diffs, we will first change it to be easily
convertible to a BlockHeight/BlockMtp pair.
2025-05-06 15:50:55 +00:00
Andrew Poelstra dcbdb7ca8a
units: add checked arithmetic to Block{Height,Mtp}{Interval,} 2025-05-06 15:50:53 +00:00
Andrew Poelstra 4300271f0c
units: add constructor for absolute::Mtp from timestamps
This is a convenience method to allow direct construction of
absolute::Mtp rather than going through units::BlockMtp.
2025-05-06 15:50:46 +00:00
Andrew Poelstra 4e4601b3d5
units: rename BlockInterval to BlockHeightInterval
Now that we have BlockMtpInterval we want to distinguish BlockInterval
from it.
2025-05-06 15:50:43 +00:00
Andrew Poelstra cb882c5ce1
units: add global `BlockMtpInterval` type
See the previous commit message for justification; for sensible
arithmetic on block timestamps we need the ability to do MTP
calculations on arbitrary MTPs and arbitrary intervals between them.
However, the absolute::Mtp and relative::MtpInterval types are severely
limited in both range and precision.

Also adds a bunch of arithmetic ops to match the existing ops for
BlockHeight and BlockInterval. These panic on overflow, just like the
underlying std arithmetic, which I think is reasonable behavior for
types which are documented as being thin wrappers around u32.

We may want to add checked_add, checked_sub and maybe checked_sum
methods, but that's out of scope for this PR.
2025-05-06 15:19:36 +00:00
Andrew Poelstra 4e3af5162f
units: add global `BlockMtp` type
For our relative locktime API, we are going to want to take differences
of arbitrary MTPs in order to check whether they meet some relative
timelock threshold.

However, the `locktime::absolute::Mtp` type can only represent MTPs that
exceed 500 million. In practice this is a non-issue; by consensus MTPs
must be monotonic and every real chain (even test chains) have initial
real MTPs well above 500 million, which as a UNIX timestamp corresponds
to November 5, 1985.

But in theory this is a big problem: if we were to treat relative MTPs
as "differences of absolute-timelock MTPs" then we will be unable to
construct relative timelocks on chains with weird timestamps (and on
legitimate chains, we'd have .unwrap()s everywhere that would be hard to
justify). But we need to treat them as a "difference of MTPs" in *some*
sense, because otherwise they'd be very hard to construct.
2025-05-06 15:19:35 +00:00
Andrew Poelstra a3228d4636
units: pull u32 conversions for BlockHeight/BlockInterval into macro
There is a lot of duplicated code between BlockHeight and BlockInterval.
It obfuscates the differences between them: which timelock types they
can be converted to/from and what their arithmetic properties are.
2025-05-06 15:19:35 +00:00
merge-script 7ca45e861b
Merge rust-bitcoin/rust-bitcoin#4028: hashes: several cleanups
a5d96ceb39 hashes: remove private `internal_new` method (Andrew Poelstra)
0aeff359f5 hashes: reformat (Andrew Poelstra)
aadd7df266 hashes: move `from_engine` fn impl out of macro body (Andrew Poelstra)

Pull request description:

  This is a followup to https://github.com/rust-bitcoin/rust-bitcoin/pull/4010 which does some simple cleanups to the hash macros and some function signatures.

ACKs for top commit:
  tcharding:
    ACK a5d96ceb39

Tree-SHA512: e8c3d8770fe3a49da4eb2d548af86cbe6e0e17efcac419815f4953b7dafffbd3e5c0be65574e08c86d09fe594d95512dfd7837534be429b1490fea973ec4d5e6
2025-05-06 13:42:36 +00:00
Erick Cestari c11772a768
Accept flexible input types for Taproot-related functions
Refactor Taproot functions to accept any type implementing `Into<XOnlyPublicKey>`,
instead of requiring `XOnlyPublicKey` directly. This improves ergonomics when working
with compatible types, avoiding unnecessary `.into()` conversions at call sites.
2025-05-06 09:01:27 -03:00
Erick Cestari 2a518d62e6
Wrap secp256k1::XOnlyPublicKey to improve error handling
This commit creates a wrapper type for XOnlyPublicKey instead of
directly re-exporting it from the secp256k1 library.
2025-05-06 09:01:17 -03:00
Jamil Lambert, PhD 52940d4e12
Prefix unused variables with _ in rustdocs
There is a lint warning about unused variables in the rustdoc examples.

Prefix them with an underscore.
2025-05-06 10:28:51 +01:00
Jamil Lambert, PhD a852aef4b8
Remove unused imports in rustdocs
There is a lint warning about unused imports in the rustdoc examples.

Remove them.
2025-05-06 10:26:00 +01:00
Jamil Lambert, PhD 5ba763f1a2
Update Github CI to rustc nightly-2025-05-02 2025-05-06 09:55:37 +01:00
Jamil Lambert, PhD 09132b80e1
Fix rustdoc compile_fail example
The function name in the example is the std function not this crates.
There is also an unused variable.

Correct the name of the function and prefix the unused vairable with an
underscore.
2025-05-06 09:55:30 +01:00
Jamil Lambert, PhD 282434d4bd
Use variable directly in format! string
There is a new lint error on nightly-2025-04-25 "variables can be used
directly in the `format!` string".

Use the variables in the `format!` string for all cases in
`bitcoin/examples/`.
2025-05-06 09:49:03 +01:00
Jamil Lambert, PhD 2fbbc825c9
Allow uninlined format args
There is a new lint error on nightly-2025-04-25 "variables can be used
directly in the `format!` string".

Exclude the lint to allow the existing syntax in `format!` strings.
2025-05-06 09:49:02 +01:00
Daniel Roberts 7ecef176f9 Fix documentation error for `TweakedPublicKey::serialize` 2025-05-06 03:06:17 -05:00
merge-script 2d93c8e5d1
Merge rust-bitcoin/rust-bitcoin#4448: bitcoin: remove torv2 support
53d32c9e4f bitcoin: remove torv2 support (Bruno Garcia)

Pull request description:

  This PR removes support to TorV2 since it's deprecated and no longer useful to have it.

ACKs for top commit:
  apoelstra:
    ACK 53d32c9e4f0ef0f3b2c7d4dcba42e3ac5344f78a; successfully ran local tests
  tcharding:
    ACK 53d32c9e4f

Tree-SHA512: 69a2ba399d5eac7f132519ab83362fbd8739d9e975795e441cefa75896ddbf4041db2125ffde51316f9ad69aa0b62c8b226ccff042b0dae6d3c615826bc339f4
2025-05-06 02:50:48 +00:00
Tobin C. Harding 3fa7889ff7
just: Add update-lock-files alias
More terse more betterer - just ulf already.
2025-05-06 09:30:03 +10:00
Tobin C. Harding 51fe619fe0
Set deprecation to released date of to_inner
In #4373 we added a couple new conversion methods and deprecated the
`to_inner` ones. During that the deprecation date was set to `0.33.0`.

We have backported the changes and will deprecate in `0.32.6` so set the
version number now so we don't forget later.
2025-05-06 09:10:07 +10:00
merge-script 723cf91060
Merge rust-bitcoin/rust-bitcoin#4446: Fix broken changelog links
44d01d0ce4 Fix broken changelog links (GarmashAlex)

Pull request description:

  Fixed malformed markdown links in bitcoin/CHANGELOG.md that were causing errors. Specifically, removed double parentheses from links to primitives and units  CHANGELOG.md files, ensuring proper rendering and accessibility of the documentation.

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

Tree-SHA512: e2d2598070c3df8e4dfa59c019d8ab9a1f86731a70624ceef80b68849454bd3828c558ef8eb30bb9d56c648fcacccea459d2a7a536021d65c2fbcbe5595916ce
2025-05-05 20:00:52 +00:00
merge-script 541acade87
Merge rust-bitcoin/rust-bitcoin#4423: mutants: Remove `impl Display` from mutants.toml exclusion list
055ab7e684 Remove impl Display from mutants exclusion list (Jamil Lambert, PhD)

Pull request description:

  The output of Display should not change in stable crates for types that have well defined formatting and ones that implement FromStr. Crates that are included in the mutation testing have been updated to have regression tests for all relevant Display implementations in #4420 and #4422.

  Remove the exclusion so that the Display implementations are included in mutation testing.

  Together with #4420 and #4422 Closes #4415

ACKs for top commit:
  tcharding:
    ACK 055ab7e684
  apoelstra:
    ACK 055ab7e684e53783b56139d14779fb39268e8f3c; successfully ran local tests
  brunoerg:
    code review ACK 055ab7e684

Tree-SHA512: 703aeee57ec9459b8cef38adbbf04d7bcb2bc425db22512e6936a5a9f6a51c740f62b03ab070aed11bd17740ae6b9f510ec743fd683f98cb03e0a1d086a4784e
2025-05-05 19:24:59 +00:00
Bruno Garcia 53d32c9e4f bitcoin: remove torv2 support 2025-05-05 15:27:35 -03:00
Andrew Poelstra a5d96ceb39
hashes: remove private `internal_new` method
This method is used to implement `from_byte_array`. But there is no need
for the method to exist. We can just inline it in `from_byte_array` and
reduce the amount of indirection in our macros.

Also make the same change in sha256t.
2025-05-05 17:00:13 +00:00
Andrew Poelstra 0aeff359f5
hashes: reformat
Essentially this just adds indentation after the previous commit.
2025-05-05 17:00:12 +00:00
Andrew Poelstra aadd7df266
hashes: move `from_engine` fn impl out of macro body
This macro is pretty weird -- it requires that a freestanding
`from_engine` method exists, which it uses to implement a `from_engine`
method within an impl block, by just calling through to the freestanding
method.

To reduce indirection, at a very small cost in increased repeated code
(we now need to add a `impl Hash {` and `}` and doccomment around each
freestanding function, we just remove this from the macro entirely.

This will allow us to implement `from_engine` for `sha256t::Hash` in a
different way than for the non-generic hash types.

To minimize the diff, we do not re-indent the freestanding
`from_engine`. We will do that in the next commit. However, the diff is
still a bit noisy because I had to replace `fn from_engine` with `pub fn
from_engine` in every case. I took the opportunity to also change the
return type from `Hash` to `Self` to make it clearer that these are
constructors.
2025-05-05 17:00:07 +00:00
merge-script ec44656933
Merge rust-bitcoin/rust-bitcoin#4438: Automated nightly rustfmt (2025-05-04)
1f19d9b4bd 2025-05-04 automated rustfmt nightly (Fmt Bot)

Pull request description:

  Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

ACKs for top commit:
  apoelstra:
    ACK 1f19d9b4bd8c55b9a7dc233c4b969d5d54d3a951; successfully ran local tests
  tcharding:
    ACK 1f19d9b4bd

Tree-SHA512: c13d24482848cc6e103304b52bd51964fbca9f3b09b5c179af7956aef0537b6cc05014a203844c93d0b21da08cd51bf4a84dc5611b61ae5684ae57b0beb2848f
2025-05-05 12:53:41 +00:00
yancy 13cbead947 Use NumOpResult instead of Option
Prefer the more descriptive NumOpResult return type over Option where
return types are fallible.

The returned type NumOpResult is already annotated as must_use per the
lint, so must_use can be removed after changing the method return types
to NumOpResult.
2025-05-05 07:18:15 -05:00
yancy 002a0382aa Mark function constant
Allow this function to be called elsewhere in the codebase in const
context.
2025-05-05 07:17:16 -05:00
GarmashAlex 44d01d0ce4
Fix broken changelog links
Fixed malformed markdown links in bitcoin/CHANGELOG.md that were causing errors.
Specifically, removed double parentheses from links to primitives and units 
CHANGELOG.md files, ensuring proper rendering and accessibility of the documentation.
2025-05-05 12:19:13 +03:00
merge-script 1b04f5df65
Merge rust-bitcoin/rust-bitcoin#4431: units: rename relative locktime types, absolute::Time, and constructors
826acb8273 units: rename relative::HeightInterval constructors (Andrew Poelstra)
39b4f7670d units: rename relative::Height to HeightInterval (Andrew Poelstra)
d3619cc1bc units: deprecate relative::MtpInterval::to_consensus_u32 (Andrew Poelstra)
1a6b8b4c7a units: rename relative::Time to MtpInterval (Andrew Poelstra)
39b057fade units: rename absolute::Height consensus functions (Andrew Poelstra)
5a8f33f380 units: rename absolute::Mtp consensus functions (Andrew Poelstra)
8ffcd2cf30 units: rename absolute::Time to absolute::Mtp (Andrew Poelstra)

Pull request description:

  This PR does a whole bunch of renames to the `units` locktime modules. These modules contain the underlying units for locktime types and hopefully aren't used directly too often, which should minimize the disruption from these renames.

  This fixes a number of issues:

  * Confusion between blocktimes and MTPs (which in fairness, *are* blocktimes, but they're not the one that users are likely to reach for)
  * Constructor and conversion names that imply there is a "consensus encoding" for these bare units, which corresponded to the consensus encoding of the corresponding locktimes/sequence numbers
  * `from_*` methods without `to_*` methods and vice-versa (overlaps with the above)
  * the horribly named `value` method on relative heights and times (but not absolute ones)

  This PR does **not** remove the `MtpAndHeight` type, nor does it add constructors for `Mtp` from lists of blocktimes. This is because the PR was too big already and I felt I should split it up.

  Alternate to #4427

ACKs for top commit:
  tcharding:
    ACK 826acb8273

Tree-SHA512: 6e0491e17927625cde85c2cf92ff152a10613e632474122a626ee31b662d21c09fcb9fa3014c44708c97536535a33845cbbcd81e73dcdf98e9ee9fd6143c698f
2025-05-05 09:08:30 +10:00
Fmt Bot 1f19d9b4bd 2025-05-04 automated rustfmt nightly 2025-05-04 01:41:13 +00:00
merge-script 082075304e
Merge rust-bitcoin/rust-bitcoin#4373: Add as_inner method to TweakedKeypair
3bb6c73f2d Add methods to retrieve inner types (Shing Him Ng)

Pull request description:

  Resolves #4345

ACKs for top commit:
  tcharding:
    ACK 3bb6c73f2d
  apoelstra:
    ACK 3bb6c73f2d3edd1165b7b7f3a833fa471786e166; successfully ran local tests; should backport to 0.32.x

Tree-SHA512: c89017bbc2126ec62c756c4ee9b49dcc8b94a3063a8155aadcf7c69a6f0bc9337baedffe7f52a4ab6f0b738302bea683391d394483c4c7eefbb622b97d34d26c
2025-05-03 23:24:19 +00:00
Andrew Poelstra 826acb8273
units: rename relative::HeightInterval constructors
Rename `value` to `to_height` to be symmetric with `from_height`;
deprecate `to_consensus_u32` which had no symmetric `from_consensus_u32`
and was only used to implement the corresponding methods in primitives
and bitcoin.
2025-05-03 03:12:08 +00:00
Andrew Poelstra 39b4f7670d
units: rename relative::Height to HeightInterval
This is disruptive, but makes the type name consistent with
`MtpInterval` and also greatly improves clarity, helping to distinguish
between absolute and relative locktimes and reminding the author (and
reviewer) of locktime code that this needs to be a diff.
2025-05-03 03:12:08 +00:00