Commit Graph

6552 Commits

Author SHA1 Message Date
jamillambert 015fb1be3b
Split invalid derivation path test
The test tests two sperate things.

Split the test into invalid path and out of range.
2025-06-03 11:19:52 +01:00
jamillambert 76dd6100a2
Split derivation path test into valid and invalid
Make the tests separate to make tests smaller and easier to read.

There are no logic changes.
2025-06-03 11:18:44 +01:00
merge-script a419fc9aa6
Merge rust-bitcoin/rust-bitcoin#4565: Remove all `p2p` dependency from `network`
cbe04b00c6 Remove all `p2p` dependency from `network` (rustaceanrob)

Pull request description:

  Motivated by moving the `p2p` module to its own crate. `TryFrom` and `From` are already implement for converting to and from `Network`/`Magic`. The methods related to `Magic` are removed from `Network`, as well as any reference to `p2p` in the documentation, as `bitcoin` would no longer depend on `p2p`.

  The deser roundtrip test are relocated to `p2p/mod.rs`

ACKs for top commit:
  tcharding:
    ACK cbe04b00c6
  apoelstra:
    ACK cbe04b00c67eab896b7ec0535194771ec36cb68f; successfully ran local tests

Tree-SHA512: ac3aa2eef4d78efd719ccc032a4266827faff8c87997111fa0050765b732462e5e5811c8aa923aedba335cbaad9a374fd54dbbe0f4978a1111d0839a5942af7d
2025-06-01 18:23:15 +00:00
merge-script 7ff1823073
Merge rust-bitcoin/rust-bitcoin#4572: Introduce empty p2p messages crate
de320714fb Introduce empty p2p messages crate (rustaceanrob)

Pull request description:

  Peer to peer messages change on occasion, and we would like to add messages as they are released from Bitcoin Core. Add an empty crate to take the crate name.

ACKs for top commit:
  tcharding:
    ACK de320714fb
  apoelstra:
    ACK de320714fbe46e4fda858d5c1c07f5dd1cc842f0; successfully ran local tests

Tree-SHA512: 68c8080c524c30eb5ec0aca14e74c8196a7cfffabe32d47773d56b8a64850617094b3c2088dfce20b4abfca31c82b19369703722d0a98aee636c383318953da7
2025-05-31 23:04:25 +00:00
merge-script 2113a32276
Merge rust-bitcoin/rust-bitcoin#4571: Move `p2p` encodings from `encode` and into `p2p`
20779bdbc8 Move `p2p` encodings out of `encode` (rustaceanrob)
94bcff28b1 p2p: Add wrappers for messages that use `Vec` (rustaceanrob)

Pull request description:

  To move `p2p` into a crate:
  1. All `Encodable` implementations for `p2p` must be defined in `p2p`. To accomplish this, and anything else in the future related to encoding, I added a `deser` module with the necessary macro to implement `Encodable` for `Vec<T> where T: Encodable`.
  2. Because the orphan rule would apply for implementing `Encodable`for `Vec` within `p2p`, three types defined within `p2p` are used to wrap the `Vec` and snake around the orphan rule.

ACKs for top commit:
  tcharding:
    ACK 20779bdbc8
  apoelstra:
    ACK 20779bdbc8ebcac2365d122e857c23b3d8e8d1e7; successfully ran local tests

Tree-SHA512: 7abfe5b853e84bb465579309f80a0687c325217f6f342651278bedf540c4d17ae16683ab02dea5e3d98d90790deb12c6bc7d572a92cec8e19ff94e395bc0d29c
2025-05-31 21:09:28 +00:00
merge-script 6d8299e8b8
Merge rust-bitcoin/rust-bitcoin#4468: Improve lock times - fix off-by-one bug
4ccecf5dec Fix stale Height type link (Tobin C. Harding)
caebb1bf73 units: relative: Do minor rustdocs fixes (Tobin C. Harding)
40bb177bc2 Put is_satisfied_by functions together (Tobin C. Harding)
480a2cd62a Favour new function `from_mtp` over deprecated (Tobin C. Harding)
f9d6453d5b Shorten locktime type term (Tobin C. Harding)
727047bd39 Fix off-by-one-bug in absolute locktime (Tobin C. Harding)
3ffdc54ca5 Fix off-by-one bug in relative locktime (Tobin C. Harding)
a2ff8ddbbb Improve relative::LockTime is_satisfied_by_{height, time} (Tobin C. Harding)

Pull request description:

  Make the APIs uniform in relative and absolute locktimes in relation to the `is_satisfied_by` functions. In doing so improve the API and fix an off-by-one bug when checking satisfaction of locks by height.

  Done in three patches but maybe should be squashed? Probably easiest to review by looking at all the `is_satisfied_by*` functions and convincing yourself we got it right.

  EDIT: Now has 5 cleanup patches also (mostly docs cleanups).

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

Tree-SHA512: 9206cb464a06647510a35a7d564062823117e75df60251969be458616f4f5d04acf0aada53dbf7d493a2a2a72d26b3a300417a6499e45413d5f2a011538b7826
2025-05-31 15:48:29 +00:00
merge-script b4f280b9e3
Merge rust-bitcoin/rust-bitcoin#4580: fix typo Porallel to Parallel crypto.rs
357ae4051a fix typo Porallel to Parallel crypto.rs (Fallengirl)

Pull request description:

  Hi devs! Found and fixed one typo in `hashes/src/ripemd160/crypto.rs`

  `Porallel` - `Parallel`

ACKs for top commit:
  tcharding:
    ACK 357ae4051a

Tree-SHA512: 67b166f8f0262cc9f4fdd9d4cbe74977ca86e0256d0129f645559aa4e75fd30d978d8995d503932c90f000eee4d87b47cc4dd5eac8405d5cd02124346ad35b3a
2025-05-30 21:31:06 +00:00
merge-script b0981fc21d
Merge rust-bitcoin/rust-bitcoin#4575: Fix typo
7b52b9c3a3 Fix typo (yancy)

Pull request description:

  Seems the comment has a stutter

ACKs for top commit:
  tcharding:
    ACK 7b52b9c3a3
  apoelstra:
    ACK 7b52b9c3a3c28afad41d9a246302ce95e4997ee5; successfully ran local tests

Tree-SHA512: 1cb11c03bb3043c19936dbe4c2ccfa1e8fa43e90c118c969da536d010d95762966cc86e257e3365d18d96cc6dfe4a63d94c4d16b1b766dde3882286ce9bb4925
2025-05-30 20:37:12 +00:00
merge-script b8c356613b
Merge rust-bitcoin/rust-bitcoin#4561: Do not derive `Default` on `CompactTarget`
e47836fb1e Do not derive Default on CompactTarget (Tobin C. Harding)

Pull request description:

  It is not immediately obvious what a zero value compact target is. Because of this and the fact that we are trying to release minimal code in `primitives 1.0` its best to remove the `Default` derive.

  This is an API breaking change.

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

Tree-SHA512: 7edb067a7ed66af8155b86b2391ee839b0a21b3d8d36b555123b14e93f1822b89c080328464b194e4ff47643440c56fa5afee929fe58b52d5f1cf84c9b96ca83
2025-05-30 18:29:43 +00:00
Fallengirl 357ae4051a
fix typo Porallel to Parallel crypto.rs 2025-05-30 11:31:56 +02:00
rustaceanrob cbe04b00c6
Remove all `p2p` dependency from `network`
Motivated by moving the `p2p` module to its own crate. `TryFrom` and
`From` are already implement for converting to and from
`Network`/`Magic`. The methods related to `Magic` are removed from
`Network`, as well as any reference to `p2p` in the documentation, as
`bitcoin` would no longer depend on `p2p`.

The deser roundtrip test are relocated to `p2p/mod.rs`
2025-05-29 15:20:10 +01:00
yancy 7b52b9c3a3 Fix typo 2025-05-28 20:06:31 -05:00
merge-script 6c228a3626
Merge rust-bitcoin/rust-bitcoin#4507: units: Move code out of wrapper macro
2a3e606d89 units: Move some things out of impl_u32_macro (Tobin C. Harding)

Pull request description:

  Recently we added a private `impl_u32_macro`. It included a bunch of associated consts and a pair of u32 constructor/getter functions.

  We overlooked the fact that the macro produces incorrect docs.

  Move the offending code out of the macro and into the already existent impl block for each type.

  Docs only, no other logic change.

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

Tree-SHA512: ad4bdbb35bc674e9664e293841e14dc2374c8baddf3e795edb666c75860f02728e939ef5a93ede6f4c951e92c5dd5368d6a6b9662cf6d5b268f73ab5ac97e2cc
2025-05-28 15:24:55 +00:00
merge-script f0302f2ecd
Merge rust-bitcoin/rust-bitcoin#4570: fix(p2p): remove `AddrV2` <> `SocketAddr` conversions
6335c623f6 fix(p2p): remove `AddrV2` <> `SocketAddr` conversions (Luis Schwab)

Pull request description:

  This PR reverts #4521 due to loss/creation of port information during the conversion. Users should use the `AddrV2` <> `IpAddr` conversion instead.

  Closes #4566

ACKs for top commit:
  Kixunil:
    ACK 6335c623f6
  tcharding:
    ACK 6335c623f6

Tree-SHA512: f183756467ca17bb7e7078023a769ec33d3deb4146ab7ec63ef961107ab93ec975c9adffd9eeddc79250abfa1cee9eccbbcaef7466cf4c2c21205b69d8e9eb4f
2025-05-28 14:28:10 +00:00
merge-script 3c8eeeb42a
Merge rust-bitcoin/rust-bitcoin#4562: Remove redundant `ServiceFlags` test
9d956e8643 test: remove redundant `ServiceFlags` test (rustaceanrob)

Pull request description:

  The `ServiceFlags` type is already tested within p2p/mod.rs with a nearly identical test. This type also has nothing to do with `network`

  ref: https://github.com/rust-bitcoin/rust-bitcoin/blob/master/bitcoin/src/p2p/mod.rs#L400

ACKs for top commit:
  tcharding:
    ACK 9d956e8643
  apoelstra:
    ACK 9d956e8643214b3c1ad0e42cc630e2f35f7b7994; successfully ran local tests

Tree-SHA512: d113609070e3df6d44b1ed57c40c1bce251d59fa22eb1abbf6c576fd84e21464553bee7fa97eba000ad9c1b8ef98e2ba04aec7077486273de9b7e54341ba894b
2025-05-28 13:48:43 +00:00
rustaceanrob de320714fb
Introduce empty p2p messages crate
Peer to peer messages change on occasion, and we would like to add
messages as they are release from Bitcoin Core. Add an empty crate to
take the crate name.
2025-05-28 09:44:00 +01:00
merge-script 0064ad67a6
Merge rust-bitcoin/rust-bitcoin#4557: Move CheckedSum and add Weight
9dac4d69e0 Implement CheckedSum for Weight iterator (yancy)
0dbcd09bbc Move CheckedSum trait to crate root (yancy)

Pull request description:

  * Move CheckedSum to the crate root so that other types can be added
  * Add Weight to CheckedSum

ACKs for top commit:
  tcharding:
    ACK 9dac4d69e0
  apoelstra:
    ACK 9dac4d69e0f142e9a2dc4b61ea49365a8cae3f4b; successfully ran local tests

Tree-SHA512: 3e4b7f79074e23493ccd17a026542081f0d7a811f4f35edb7994ada95bf414a166531f142ad4986d27fcec448209b2ffa56813b495b5df6b6e8fcd589392e0c1
2025-05-28 04:09:12 +00:00
rustaceanrob 20779bdbc8
Move `p2p` encodings out of `encode`
All of the `Encodable` implementations are defined within `p2p` with the
exception of `p2p` types that are a `Vec`. To fully decouple `p2p` from
`encode` we can define these in `p2p` like the others. This is the final
step in removing anything `p2p` related from the rest of `bitcoin`.
2025-05-27 14:41:03 +01:00
Luis Schwab 6335c623f6
fix(p2p): remove `AddrV2` <> `SocketAddr` conversions 2025-05-27 10:32:23 -03:00
rustaceanrob 94bcff28b1
p2p: Add wrappers for messages that use `Vec`
In preparation to move `p2p` to its own crate, any `Vec<T>` that satisfies
`T: Encodable` will not trivially implement `Encodable` because of the
orphan rule. A type defined within p2p may implement `Encodable`,
however, and the simplest possible type is one that simply wraps the
vector. Three types that will implement `Encodable` within `p2p` are
added here.
2025-05-27 13:55:21 +01:00
rustaceanrob 9d956e8643
test: remove redundant `ServiceFlags` test
The `ServiceFlags` type is already tested within p2p/mod.rs with a
nearly identical test. This type also has nothing to do with `network`
2025-05-27 10:09:44 +01:00
Tobin C. Harding 2a3e606d89
units: Move some things out of impl_u32_macro
Recently we added a private `impl_u32_macro`. It included a bunch of
associated consts and a pair of u32 constructor/getter functions.

We overlooked the fact that the macro produces incorrect docs.

Move the offending code out of the macro and into the already existent
impl block for each type.

Docs only, no other logic change.
2025-05-27 08:36:18 +01:00
Tobin C. Harding e47836fb1e
Do not derive Default on CompactTarget
It is not immediately obvious what a zero value compact target is.
Because of this and the fact that we are trying to release minimal code
in `primitives 1.0` its best to remove the `Default` derive.

This is an API breaking change.
2025-05-27 08:09:56 +01:00
yancy 9dac4d69e0 Implement CheckedSum for Weight iterator
Expose `checked_sum` method to sum an iterator of Weights checked.
2025-05-26 19:01:56 -05:00
yancy 0dbcd09bbc Move CheckedSum trait to crate root
In order to add other types to CheckedSum, remove from the Amount
module.  In so doing, other types added to CheeckSum do not need to be
imported into Amount.
2025-05-26 19:01:42 -05:00
merge-script 5e0b86d2b1
Merge rust-bitcoin/rust-bitcoin#4440: Add support for de/serializing PSBT_{IN,OUT}_MUSIG2_PARTICIPANT_PUBKEYS
2481695b45 Add tests for BIP-373 PSBT_{IN,OUT}_MUSIG2_PARTICIPANT_PUBKEYS serialization and deserialization (Daniel Roberts)
3e8e6d9aa1 Add BIP-373 PSBT_{IN,OUT}_MUSIG2_PARTICIPANT_PUBKEYS serialization and deserialization (Daniel Roberts)

Pull request description:

  This change adds support for serializing and deserializing two PSBT keys from BIP-373: `PSBT_IN_MUSIG2_PARTICIPANT_PUBKEYS` and `PSBT_OUT_MUSIG2_PARTICIPANT_PUBKEYS`

  This is a part of #4207 that can be implemented independently of the rest (which depends on https://github.com/rust-bitcoin/rust-secp256k1/pull/716). I believe this satisfactorily avoids changing things multiple times on end users, *however* it's not *completely* transparent to end users, since any code that currently accesses these fields through `unknown` will need to be updated. Later, when `PSBT_IN_MUSIG2_PUB_NONCE` and `PSBT_IN_MUSIG2_PARTIAL_SIG` are supported, code will need to be updated a second time to retrieve them from the correct place instead of `unknown`. I'm of the opinion that this imposes a very minor maintenance burden, only consisting of *removing* deserialization code.

  ### Notes/Requests for feedback

  - For the most part I used my judgement rather than `cargo fmt` since `cargo fmt` already had a lot of other complaints, but of course I'll update if I need to.
  - To satisfy the requirement that every commit pass tests, the commit updating the psbt serde regression test should probably be squashed into the first commit, but I just wanted to confirm that before I did it. I suppose similarly, the test commit could be squashed as well?
  - I waffled between `musig2_participants` and `musig2_participant_pubkeys`, but I've decided to go with `musig2_participant_pubkeys` because that is consistent with Bitcoin Core

ACKs for top commit:
  tcharding:
    ACK 2481695b45
  apoelstra:
    ACK 2481695b456bcccbb25c247c1fd39bbda24dbb30; successfully ran local tests

Tree-SHA512: af884923593c9cbb24ff3f1f08219458538592fabde85d5d65bc2d9bc7bf0b1a73dac38d2c56303b4f3162088db129ea7e879c3d4b324e965933c121ef939a07
2025-05-26 19:17:48 +00:00
merge-script 9371018cbf
Merge rust-bitcoin/rust-bitcoin#4554: Sane InputWeightPredition Arbitrary Type
8dd24cb67b Add Arbitrary type for InputWeightPrediction (yancy)

Pull request description:

  This type creates sane Arbitrary InputWeightPrediction types that do not panic.  To this end, when a custom type is created by calling new() or from_slice() constructor, only use values that would no greater than block size 4 MB of witness data or 1 MB of non-witness data.  This idea is from the discussion here  https://github.com/rust-bitcoin/rust-bitcoin/issues/4547

  I'd be up for a future PR that limits the constructors to no greater than 1MB or 4MB witness data, although I feel like this Arbitrary type will be less controversial.

  Furthermore, I did test this locally against my application and no panics where produced either through the constructor nor auxiliary methods `total_weight` or `witness_weight`.

ACKs for top commit:
  tcharding:
    ACK 8dd24cb67b
  apoelstra:
    ACK 8dd24cb67b948e619038b387d6c3bd79252a5de1; successfully ran local tests

Tree-SHA512: ff33f1a6ced4f68c4d236e362b1d03da405a8b9701cda0405405421ca21a563fa288c8065a9309e542fec0c8bc850119bcf93a2dc5e27677c42b35b1e5e52722
2025-05-26 14:01:51 +00:00
yancy 8dd24cb67b Add Arbitrary type for InputWeightPrediction
This type creates sane Arbitrary InputWeightPrediction types that do
not panic.  To this end, when a custom type is created by calling new()
or from_slice() constructor, only use values that would no greater than
block size 4 Mwu.
2025-05-25 13:15:56 -05:00
merge-script 3c64cef5b5
Merge rust-bitcoin/rust-bitcoin#4556: fix error grater to greater array_vec.rs
9fb48bc0ef fix error grater to greater array_vec.rs (Alex Pikme)

Pull request description:

  Error fixed:
  **One `grater` than 15 - One `greater` than 15**

ACKs for top commit:
  yancyribbens:
    cr ACK 9fb48bc0ef
  apoelstra:
    ACK 9fb48bc0efec96e332beb8e0d4c6239eb23b6da5; successfully ran local tests

Tree-SHA512: 5f2d88ed33ea30971a20b58a383f9c407feeab3e8d65b44356477b9aff0743e36f7a901099df2cd64c6168b2cf4ce92ed9c3a93c4ea596eff315522e8bf2a1dd
2025-05-25 17:14:16 +00:00
merge-script 0432102472
Merge rust-bitcoin/rust-bitcoin#4549: Add trait to InputWeightDescription
07c4f76052 Add comparison traits to InputWeightPrediction (yancy)

Pull request description:

  * Partial Eq is added to Enable symmetric and transitive comparison.
  * Eq is added to enable reflexive comparison.

ACKs for top commit:
  apoelstra:
    ACK 07c4f760523b7a196bf160f585c2b437dea5b532; successfully ran local tests
  tcharding:
    ACK 07c4f76052

Tree-SHA512: baeb957f000ac0f3be89166243b9cc7126daad06ad6688b811037ca5f5713cad1184c7135b2f4f32235457c0f53eb41304846bdd8a84e57b10a6eff0905224e8
2025-05-25 14:42:56 +00:00
Daniel Roberts 2481695b45 Add tests for BIP-373 PSBT_{IN,OUT}_MUSIG2_PARTICIPANT_PUBKEYS serialization and deserialization 2025-05-25 08:28:16 -05:00
Daniel Roberts 3e8e6d9aa1 Add BIP-373 PSBT_{IN,OUT}_MUSIG2_PARTICIPANT_PUBKEYS serialization and deserialization 2025-05-25 08:28:16 -05:00
Alex Pikme 9fb48bc0ef
fix error grater to greater array_vec.rs 2025-05-25 12:47:49 +02:00
merge-script 6e66253ffb
Merge rust-bitcoin/rust-bitcoin#4555: Automated nightly rustfmt (2025-05-25)
c73131c8f0 2025-05-25 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 c73131c8f0ea7654ac392e4170737092515c1abc; successfully ran local tests

Tree-SHA512: 51995608b286cbccce0cf81e77c72ec6d25be91219e8e9bf34245a66a6f089b6bcd9d4313f1dc82068655010268dd33f586208cfe9ebbfaed6e517b1fc3a4c37
2025-05-25 03:18:19 +00:00
Fmt Bot c73131c8f0 2025-05-25 automated rustfmt nightly 2025-05-25 01:42:57 +00:00
merge-script ecf4b2bcee
Merge rust-bitcoin/rust-bitcoin#4496: BREAKING: Change Psbt serde implementations
9aa235c24d BREAKING: Change Psbt serde implementations (Daniel Roberts)
d7e9a84339 Fix Psbt preimage keys in serde test (Daniel Roberts)
62026c1e2d Don't use PSBT_GLOBAL_XPUB as an unknown key in Psbt serde test (Daniel Roberts)

Pull request description:

  Implements the conclusion of #3454 by serializing Psbts using the BIP-174 binary encoding, optionally using base64 where appropriate.

  The core of the problem is the old derived serde implementation by its nature can't be backwards compatible when serialized in binary formats like bincode. Fields will be added to the Psbt (my motivating case in #4440 ) and this will always break formats like bincode.

ACKs for top commit:
  apoelstra:
    ACK 9aa235c24d65d23de2afc21fcbd019892bf4ad2a; successfully ran local tests
  tcharding:
    ACK 9aa235c24d

Tree-SHA512: 4dc9dbf1a71f06769d74fada7e3d5557a3df3ee78769c66c2d8480c434baa0abd2efba555137563af58da2cc1d545813eb43b6c696b363a5777a9836bc1b7382
2025-05-24 16:03:33 +00:00
merge-script c913e0ab9c
Merge rust-bitcoin/rust-bitcoin#4541: fee_rate: Put test assertions in correct order
dc2cbc21f9 Make fee_rate test identifiers uniform (Tobin C. Harding)
2e16dbb7e5 fee_rate: Put test assertions in correct order (Tobin C. Harding)

Pull request description:

  By convention we put assertions in the order `got` then `want`. This makes debugging easier.

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

Tree-SHA512: 8844a6180c170b391dc1ea6fe225022fcd0858ad8a692af807c7668e0e055e514a0886d0dcc8a63fe23740f46ea0094291c1912035e08077974717cde976f289
2025-05-24 15:28:00 +00:00
yancy 07c4f76052 Add comparison traits to InputWeightPrediction
* Partial Eq is added to Enable symmetric and transitive comparison.
* Eq is added to enable reflexive comparison.
2025-05-24 07:35:25 -05:00
merge-script d7314892d3
Merge rust-bitcoin/rust-bitcoin#4551: Automated daily update to rustc (to nightly-2025-05-23)
4ed0b8918b Automated update to Github CI to rustc nightly-2025-05-23 (Update Nightly Rustc Bot)

Pull request description:

  Automated update to Github CI workflow `rust.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

ACKs for top commit:
  tcharding:
    ACK 4ed0b8918b

Tree-SHA512: 4edf4f8e4953f34c5e5c55817b9c5c39fff49e591c6dde11571f35071014f0846baad70204a3036dd9244a12ec66aa05a1a8d45be0ea5fef101dda2c205ae4ee
2025-05-24 13:25:36 +10:00
Update Nightly Rustc Bot 4ed0b8918b Automated update to Github CI to rustc nightly-2025-05-23 2025-05-24 01:52:51 +00:00
Tobin C. Harding dc2cbc21f9
Make fee_rate test identifiers uniform
We have a bunch of unit tests, some use `f` and some use `fee_rate`.
Uniform would be better.

Elect to use the longer form just because there are only 4 instances of
the shorter one (although I personally prefer the shorter form).
2025-05-24 11:37:19 +10:00
Tobin C. Harding 2e16dbb7e5
fee_rate: Put test assertions in correct order
By convention we put assertions in the order `got` then `want`. This
makes debugging easier.
2025-05-24 11:36:28 +10:00
merge-script 1c07916777
Merge rust-bitcoin/rust-bitcoin#4538: Use `_u32` in `FeeRate` constructor instead of `_unchecked`
a1ce2d1ac8 Use _u32 in FeeRate constructor instead of _unchecked (Tobin C. Harding)

Pull request description:

  When constructing an `Amount` it was observed recently that a `u32` is often big enough. For the same reason we can use a `u32` to construct a fee rate instead of overflowing.

  Use `_u32`in the constructor and remove the panic.

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

Tree-SHA512: 339974c954ad613b0be684f7b2fa1402f59fe401969f3785a702ffbb14ac913ecf4c8228240d068ba4b482e38263590154167a071d823ccc9b4d0691036ca484
2025-05-23 16:18:59 +00:00
merge-script 2f2c9144ba
Merge rust-bitcoin/rust-bitcoin#4526: feat(p2p): add AddrV2 <> IpAddr conversions
3c920d1acb fix(p2p): Remove `SocketAddr::V6` <> `AddrV2::Cjdns` conversions (Erick Cestari)
2c236ae24f fuzz: Add p2p address round-trip fuzzing test (Erick Cestari)
7ad89df392 test(p2p): add tests for `AddrV2` <> `IpAddr` conversions (Erick Cestari)
e8a9a89e25 feat(p2p): add `AddrV2` <> `IpAddr` conversions (Erick Cestari)

Pull request description:

  This PR adds conversion traits between `AddrV2` and standard IP types, inspired by #4519.

  ### Changelog

  - Implement `From<IpAddr>` for `AddrV2`.
  -  Implement `From<Ipv4Addr>` for `AddrV2`.
  -  Implement `From<Ipv6Addr>` for `AddrV2.`
  - Implement `TryFrom<AddrV2>` for `IpAddr`.
  - Implement `TryFrom<AddrV2>` for `Ipv4Addr`.
  - Implement `TryFrom<AddrV2>` for `Ipv6Addr`.
  - Implement `AddrV2ToIpAddrError` enum and it's `fmt::Display`.
  - Implement `AddrV2ToIpv4AddrError` enum and it's `fmt::Display`.
  - Implement `AddrV2ToIpv6AddrError` enum and it's `fmt::Display`.
  - Renamed `AddrV2ConversionError` to `AddrV2ToSocketAddrError`
  - Tests for `TryFrom` conversions.

ACKs for top commit:
  apoelstra:
    ACK 3c920d1acb23d84976c0b8e632d8f1068ebbd1fd; successfully ran local tests
  tcharding:
    ACK 3c920d1acb

Tree-SHA512: 6bc8007252ac78fba8dff5de59bbd4134f0dc1f801cdf23676b9b1ea256558cb7ddca81f932cccba7fc34e70d204184f0f9e5f18e4485bd922196fb5f78fd588
2025-05-23 14:56:21 +00:00
merge-script 3784573269
Merge rust-bitcoin/rust-bitcoin#4545: fix dead link CONTRIBUTING.md
cd610464ec fix dead link CONTRIBUTING.md (Fallengirl)

Pull request description:

  Hi devs! I replaced dead link
  `https://github.com/bitcoin/bips/blob/master/bip-0000.mediawiki` to `https://github.com/bitcoin/bips/blob/master/bip-0001.mediawiki`
  thanks

ACKs for top commit:
  tcharding:
    ACK cd610464ec
  apoelstra:
    ACK cd610464ec17b59fedc875e4da75ec4217d6b784; successfully ran local tests; lol sure

Tree-SHA512: e960227344d32ce38cb28909eeca18b78693f267977e6da73d3b8a58d06db34e610c12288df56eb66f97fdf676eaf3abeaccf14a6aa37bebb7d185556ce543a4
2025-05-23 14:10:16 +00:00
merge-script efae4cac8a
Merge rust-bitcoin/rust-bitcoin#4544: use Self:: instead of type aliases in error impls
0a0e23fedf style: use Self:: instead of type aliases in error impls (frankomosh)

Pull request description:

  Replace `use FooError as E` with `Self::` , during pattern matching
  on the same type in Display/Error trait implementations.

  close #4536

ACKs for top commit:
  tcharding:
    ACK 0a0e23fedf
  apoelstra:
    ACK 0a0e23fedf3552df677b379d86a1e0ac6b063152; successfully ran local tests

Tree-SHA512: 25c45a890635f990afc3bc09096929f8793007852ac435f061348bff2bd79e3faabf034d1e1e277596f4f7365477f477798f1b1e0c4b918c5b0fa08f8c49e732
2025-05-23 12:39:35 +00:00
merge-script 7dcff506dd
Merge rust-bitcoin/rust-bitcoin#4542: Fix FeeRate::checked_add/sub
395252c6d9 Fix FeeRate::checked_add/sub (Tobin C. Harding)

Pull request description:

  Currently the `checked_add` and `checked_sub` functions use a `u64` for the right hand side. This leaks the inner unit because the RHS value is implicitly in the same unit.

  Make the functions have `FeeRate` on the RHS.

ACKs for top commit:
  apoelstra:
    ACK 395252c6d95fdd581ce5e8ad5d7978515aafea23; successfully ran local tests; will one-ACK merge as this is units-only

Tree-SHA512: 1f0893f75c47f720ac741ace0274171ed24efcb6d2724d0fed941899d43b213e165b97aa050d6e40eea78c527af45d090a81b9d6cbd95835ef7105585786fca6
2025-05-23 03:57:18 +00:00
merge-script 180d9286d5
Merge rust-bitcoin/rust-bitcoin#4540: Remove `impl From<u64> for FeeRate`
c63f80baec Remove impl From<u64> for FeeRate (Tobin C. Harding)

Pull request description:

  This function leaks the inner unit of `FeeRate`. We want to change the unit, best to break downstream so they notice.

ACKs for top commit:
  apoelstra:
    ACK c63f80baec0780622d70e4c8699369b0a972cb62; successfully ran local tests; will one-ACK merge as this is units-only

Tree-SHA512: 5748f2a4cb29d6554226fe20c5479cb53081da8c2788ac31abfe1a2edb4d17f13a3b3037a840fbdc29e842af3e1accc27835fd5429c7355c1351eb8883943fdc
2025-05-23 02:51:00 +00:00
merge-script d75aba2061
Merge rust-bitcoin/rust-bitcoin#4539: units: re-order ceil/floor functions
1fef5a3dc5 units: re-order ceil/floor functions (Tobin C. Harding)

Pull request description:

  We have 4 functions, 2 ceil, 2 floor but they are ordered ceil, floor, floor, ceil - this causes my head to twitch when I read it.

  The logic in the floor versions is easier so put them first, this is uniform with `fee_rate/mod.rs`.

  Code move only.

ACKs for top commit:
  apoelstra:
    ACK 1fef5a3dc55bfc1858c32f81f18840ec1d01c807; successfully ran local tests; will one-ack merge on the basis that this is trivial

Tree-SHA512: 8f15a34ee637cb6aa4013385e1e7f7c70c2e760908bec01d43a96b9c85a3d309c7b9528f13ec5f072f1166511eb7560d1b5aefdccc1a44922c92e68d527fe1a5
2025-05-22 23:39:23 +00:00
merge-script 7ad0b234ba
Merge rust-bitcoin/rust-bitcoin#4537: Use / to divide fee by weight
7e67737393 Use / to divide fee by weight (Tobin C. Harding)

Pull request description:

  Looks like this code was written before we added support for dividing `Amount` by `Weight`.

  Refactor, no logic change.

ACKs for top commit:
  apoelstra:
    ACK 7e67737393bc1a966bf2ce544d291ea30dc4f0f7; successfully ran local tests; will one-ack merge on the basis that this is trivial

Tree-SHA512: e1c97bea4eaa07ef24e82844c07c899a9baca65d0d3d2dfe32371e7b3c81363ac5844b4fdce9dbe12d8c0131d03dfd4cc13fcc5cc8a0b595ade1c1b06c727c10
2025-05-22 22:28:06 +00:00