Commit Graph

5621 Commits

Author SHA1 Message Date
merge-script 274205e147
Merge rust-bitcoin/rust-bitcoin#3923: docs: fix fee rate serde module documentation
34bde36712 docs: fix fee rate serde module documentation (jrakibi)

Pull request description:

  Update `fee_rate/serde.rs` documentation to correctly reference fee rates instead of amount

ACKs for top commit:
  tcharding:
    ACK 34bde36712
  apoelstra:
    ACK 34bde3671212f17082db9ef862e26825602fc6a6; successfully ran local tests

Tree-SHA512: 6fba6ffe4e6c7bdb548967098596b2e7f34d0980710e4f3221b68fe20346a3c1a15d5f9c2a156fc01c8d9341402e61466618520aeb8bcf94a3f818e52828eb8f
2025-01-20 16:04:57 +00:00
merge-script 05c28cf31d
Merge rust-bitcoin/rust-bitcoin#3915: Add FIFTY_BTC const to the amount types
e0028239cf api: Run just check-api (Tobin C. Harding)
5eb5941215 Add FIFTY_BTC const to the amount types (Tobin C. Harding)

Pull request description:

  The mining reward for the first epoc is 50 bitcoin. For mainnet this is old news but for regtest it is still relevant.

  Add and use a new const `FIFTY_BTC` to the `Amount` type. To keep the amount types uniform also add it to the `SignedAmount`.

ACKs for top commit:
  storopoli:
    ACK e0028239cf
  jamillambert:
    ACK e0028239cf
  apoelstra:
    ACK e0028239cf207660deb2873a92bacfa1315af634; successfully ran local tests

Tree-SHA512: 623ed8b1f5fe8dd95309179308fea83d68be4349becf6305769b0378cc9032961df2c062dc2bf702fec5e2394e8abb7360d2be6f19b6cf505db8769a5ae39e16
2025-01-20 02:42:45 +00:00
merge-script 3985333e23
Merge rust-bitcoin/rust-bitcoin#3914: units: Define constructor variable in amount tests
f01bb30121 Use sat variable for constructor (Tobin C. Harding)
34f846c074 Use ssat variable for constructor (Tobin C. Harding)

Pull request description:

  Add `sat` and `ssat` throughout the `amount::tests` module after new tests were added recently.

ACKs for top commit:
  jamillambert:
    ACK f01bb30121
  apoelstra:
    ACK f01bb30121ef5a59af069a55db727ee5a9ba71bb; successfully ran local tests

Tree-SHA512: 6a4cdc47000b22625132fe0d8faa7dbff59acfc0b6b4faffe091f885f8d0fd5f5ce15e2298c87e25bd4cc13a2611cecadb43b7d44ccd768a04cd150223577b6b
2025-01-19 16:31:10 +00:00
merge-script afc3690ac6
Merge rust-bitcoin/rust-bitcoin#3925: Automated nightly rustfmt (2025-01-19)
fec6a7669e 2025-01-19 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:
  tcharding:
    ACK fec6a7669e

Tree-SHA512: db7d2c8282059a6e19274e589e72da2477dda1cb6e618d2a237b371ed0d59a2cc5a32fa5203221bf6beb716477730dadfff97bfc9d5af448929c93230ec9faaa
2025-01-19 14:09:02 +11:00
merge-script b442d942bf
Merge rust-bitcoin/rust-bitcoin#3918: Remove deprecated `std::error::Error` trait method impls
0719997fee api: Run just check-api (Tobin C. Harding)
1e503a8d3b Remove deprecated std::error::Error trait method impls (Tobin C. Harding)

Pull request description:

  The `description` method was deprecated in Rust `v1.42`. The `cause` method was deprecated in Rust `v1.33`. Our MSRV is now Rust `v1.63`.

  We do not need to implement the deprecated functions any longer.

  Fix: #3869

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

Tree-SHA512: e627f614ab8c36ce34109b8d8ef9216e9e802e6db286fa676eff3e6741da39f03cf6080cf47f7d6aa414c5acd790f94b389b219f18992cfcc8869b668e745152
2025-01-19 03:04:41 +00:00
Fmt Bot fec6a7669e 2025-01-19 automated rustfmt nightly 2025-01-19 01:19:33 +00:00
jrakibi 34bde36712 docs: fix fee rate serde module documentation 2025-01-18 18:17:56 +05:30
Tobin C. Harding 0719997fee
api: Run just check-api 2025-01-17 13:40:18 +11:00
Tobin C. Harding 1e503a8d3b
Remove deprecated std::error::Error trait method impls
The `description` method was deprecated in Rust `v1.42`. The `cause`
method was deprecated in Rust `v1.33`. Our MSRV is now Rust `v1.63`.

We do not need to implement the deprecated functions any longer.

Fix: #3869
2025-01-17 13:40:11 +11:00
Tobin C. Harding e0028239cf
api: Run just check-api 2025-01-17 10:21:55 +11:00
Tobin C. Harding 5eb5941215
Add FIFTY_BTC const to the amount types
The mining reward for the first epoc is 50 bitcoin. For mainnet this is
old news but for regtest it is still relevant.

Add and use a new const `FIFTY_BTC` to the `Amount` type. To keep the
amount types uniform also add it to the `SignedAmount`.
2025-01-17 10:08:09 +11:00
merge-script dc76043dcf
Merge rust-bitcoin/rust-bitcoin#3911: Make `Cursor` methods const
9ef8e294ac api: Run just check-api (Tobin C. Harding)
3542803c4e Make Cursor methods const (Tobin C. Harding)

Pull request description:

  Mirror the `std::io::Cursor` type by making the same methods `const`.

ACKs for top commit:
  jamillambert:
    ACK 9ef8e294ac
  apoelstra:
    ACK 9ef8e294ac81c79f413fbe47372a3f94c926ef12; successfully ran local tests

Tree-SHA512: 60ad8169c9bcc90360fcd3c3439256d86af4a77733a00a66e9b155bdb89580d4971efd55a93f1873363ed9d24f0b2b8f5a0da1857bb5aa8a112b13e27239a984
2025-01-16 19:47:47 +00:00
merge-script 70fc3999ae
Merge rust-bitcoin/rust-bitcoin#3900: units: Fix `missing_errors_doc` clippy lint
f9be30ddbe units: Fix `missing_errors_doc` clippy lint (Jamil Lambert, PhD)

Pull request description:

  Change the `missing_errors_doc` clippy lint to `warn`.
  Allow `missing_errors_doc` in `amount/serde.rs` and `fee_rate/serde.rs`. Add missing `# Errors` sections to rustdocs where the lint gives a warning.

  One of the TODO lints in Issue https://github.com/rust-bitcoin/rust-bitcoin/issues/3825

ACKs for top commit:
  tcharding:
    ACK f9be30ddbe
  apoelstra:
    ACK f9be30ddbe5c0837ab3e408dfadabc6c6cd2068e; successfully ran local tests

Tree-SHA512: 8039804ab86c18dceadb425c8531cd4064431393367c6053249e00386f48998d8d84a3aee6ad139e7e2ca3ac3c94e05ee694d72270bf285f6b90d0ff821e622e
2025-01-16 05:13:28 +00:00
Tobin C. Harding 9ef8e294ac
api: Run just check-api 2025-01-16 14:38:35 +11:00
Tobin C. Harding 3542803c4e
Make Cursor methods const
Mirror the `std::io::Cursor` type by making the same methods `const`.
2025-01-16 13:35:25 +11:00
merge-script f1abc779f5
Merge rust-bitcoin/rust-bitcoin#3907: units: Fix `ref_option` clippy lint
29f1a4613a Enable `ref_option` lint and allow individually (Jamil Lambert, PhD)

Pull request description:

  The last `TODO` in #3825

  Allow the `ref_option` lint in the cases where the lint wants us to change the API to ```use `Option<&T>` instead of `&Option<T>` ```

  The other option would be to keep the lint as `allow` and add a comment to `Cargo.toml` as to why we are allowing it like the other cases that are allowed.

  Close #3825

ACKs for top commit:
  apoelstra:
    ACK 29f1a4613a090cd23baded1ef577aa4e3da8d33f; successfully ran local tests; nice!
  tcharding:
    ACK 29f1a4613a

Tree-SHA512: 181d617060e8ae0e75f033b1f356106fc89bdee9841085c889b775e82711c147e5282ecb0e3bf80cdb058034365bbfc7289c029ba0bf8b0b0f26d22505c63aa2
2025-01-16 02:22:06 +00:00
merge-script 6bc12e9363
Merge rust-bitcoin/rust-bitcoin#3864: Update for ParsePublicKeyError Display and Error impl
b11ace359a Fix up ParsePublickeyError (Innocent Onyemaenu)

Pull request description:

  Resolves #3835

  In #945fcd09 we forgot to Update impl for ParsePublicKeyError Display and Error traits

ACKs for top commit:
  tcharding:
    ACK b11ace359a
  apoelstra:
    ACK b11ace359a52d9137b8fe5919d9825d61e3e9fad; successfully ran local tests; thanks!!

Tree-SHA512: 5c4e5e113605bc5b9c3c0d2ca65a0fdae80726a0f2f791255cc1d6567812a9132ff4f5bd8f30276fef916469d5fd29f6d72ddf4adb6340e52f4e0198ac4fb371
2025-01-16 01:37:12 +00:00
merge-script 7706675876
Merge rust-bitcoin/rust-bitcoin#3899: units: Fix `missing_panics_doc` clippy lint
e316e6e719 Fix `missing_panics_doc` clippy lint in units (Jamil Lambert, PhD)

Pull request description:

  Change the units `missing_panics_doc` clippy lint to `warn` and allow for the functions that can't panic.

  One of the TODO lints in Issue #3825

ACKs for top commit:
  tcharding:
    ACK e316e6e719
  apoelstra:
    ACK e316e6e7195993b7dd0e005d2f22f29dfea023c5; successfully ran local tests

Tree-SHA512: 3db74e499dc590a5158869d1a80613d37b3fb09f2d428918dc23b9f1521496d8afff63988f022d6cfd7688d33295f976effe73adbadd8da93dae8fb5d2d13dc5
2025-01-16 00:08:05 +00:00
Tobin C. Harding f01bb30121
Use sat variable for constructor
As we do in other places in the `amount::tests` module; use a local
`sat` variable bound to the `Amount::from_sat` constructor.

Internal change, no logic changes.
2025-01-16 10:42:41 +11:00
Tobin C. Harding 34f846c074
Use ssat variable for constructor
As we do in other places in the `amount::tests` module; use a local
`ssat` variable bound to the `SignedAmount::from_sat` constructor.

Internal change, no logic changes.
2025-01-16 10:39:18 +11:00
Jamil Lambert, PhD e316e6e719
Fix `missing_panics_doc` clippy lint in units
Change the lint to `warn` and allow for the functions that can't panic.
2025-01-15 20:52:12 +00:00
Jamil Lambert, PhD f9be30ddbe
units: Fix `missing_errors_doc` clippy lint
Change the lint to `warn` in `units/Cargo.toml`.
Allow `missing_errors_doc` in `amount/serde.rs` and `fee_rate/serde.rs`.
Add missing `# Errors` sections to rustdocs where the lint gives a
warning.
2025-01-15 20:44:19 +00:00
Innocent Onyemaenu b11ace359a Fix up ParsePublickeyError
In #3847 we added an `InvalidCharError` into one of the variants of
`ParsePublicKeyError` but we forgot to update the trait
implementations.

Fix the `error::Error` and `Display` implementations for
`ParsePublicKeyError`. While we are at it match on `*self` as is
typical in this codebase.

 With this applied #3835 is fully resolved.

 Close: #3835
2025-01-15 21:00:55 +01:00
merge-script 87d93891a3
Merge rust-bitcoin/rust-bitcoin#3905: units: Remove `InputString` from the public API
56286265a5 api: Run just check-api (Tobin C. Harding)
39523ea1f5 units: Remove InputString from the public API (Tobin C. Harding)

Pull request description:

  Currently `InputString` is in the public API of `units` because of the trait bound on `parse::int()`. We can just do the monomorphisisation manually to remove it.

  This patch renames `int` to have three different names, one for `&str` one for `String`, and one for `Box<str>` e.g., `units::parse::int_from_str`.

  Close #3708

ACKs for top commit:
  apoelstra:
    ACK 56286265a55368572c61b03bcb81fe04fb7921c0; successfully ran local tests; this looks great!

Tree-SHA512: 5c16640fe4651fbbafd5e3558d8918414df1bb1579ca64b2256f3c10df410481ae29a77ab89f7a1571bfdd710dc6c6bd8ee9217f2c54eeef06e21ab6ce4aa735
2025-01-15 19:20:11 +00:00
Jamil Lambert, PhD 29f1a4613a
Enable `ref_option` lint and allow individually
Enable the lint and allow the ref_option lint in the cases where the
lint wants us to change the API to use `Option<&T>` instead of
`&Option<T>`
2025-01-15 15:38:41 +00:00
Tobin C. Harding 56286265a5
api: Run just check-api 2025-01-15 08:09:38 +11:00
Tobin C. Harding 39523ea1f5
units: Remove InputString from the public API
Currently `InputString` is in the public API of `units` because of the
trait bound on `parse::int()`. We can just do the monomorphisisation
manually to remove it.

This patch renames `int` to have three different names, one for `&str`
one for `String`, and one for `Box<str>`.
2025-01-15 08:09:38 +11:00
merge-script 1af293efe3
Merge rust-bitcoin/rust-bitcoin#3901: Use `Amount` in examples
668056fb36 Use Amount in examples (Tobin C. Harding)

Pull request description:

  Use the `Amount` type as parameter in examples code instead of a `u64`.

  Done as part of preparation for enforcing MAX_MONEY.

ACKs for top commit:
  apoelstra:
    ACK 668056fb36c87bb2eeeacc8fa6c44ed942c558b3; successfully ran local tests; good catch

Tree-SHA512: bbc35a2ae0313bcd0c6d6c4e22b855078ab71aa0df58f7f24e30839e66ba11a78440dfc4f15c5b38dfe3be1dbaa29ff7c2fd1dacf87dc6c73e42960940cc5618
2025-01-14 19:26:25 +00:00
Tobin C. Harding 668056fb36
Use Amount in examples
Use the `Amount` type as parameter in examples code instead of a `u64`.

Done as part of preparation for enforcing MAX_MONEY.
2025-01-14 09:48:48 +11:00
merge-script b4cb7f961f
Merge rust-bitcoin/rust-bitcoin#3886: io: Add unit tests for `Take`
ac59b25f2c io: Add unit tests for Take (Tobin C. Harding)

Pull request description:

  Add two unit tests:

  - Check we can read into an empty buffer as validation of args as part of C-VALIDATE
  - Do basic read using `Take::read_to_end` since it is currently untested.

ACKs for top commit:
  jamillambert:
    ACK ac59b25f2c
  apoelstra:
    ACK ac59b25f2cfe8d65435ea9e6f4265e52ac06e92e; successfully ran local tests

Tree-SHA512: 19dcedaec05f0f8c028c59b5eb8771568a3708cb35793db9fadcc96147c00053ddc8239e0cad6eef5dd008bfb743bd0854e7b7674d6f77872a968bb00e928925
2025-01-13 17:23:51 +00:00
Tobin C. Harding de6269082e
Merge rust-bitcoin/rust-bitcoin#3890: Automated weekly update to rustc stable (to 1.84.0)
e8b157317e Automated update to Github CI to rustc stable-1.84.0 (Update Stable Rustc Bot)

Pull request description:

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

ACKs for top commit:
  tcharding:
    ACK e8b157317e

Tree-SHA512: 89bbae0772f2d40fbfc8923b30781ab1fe339357f394e2abd64d3e10dc0c2918753fff3a3dd3e6f36ab0f531c6227346aa4b27fb9ba4002fb07c0e0404155b62
2025-01-13 09:25:58 +11:00
Tobin C. Harding ac59b25f2c
io: Add unit tests for Take
Add two unit tests:

- Check we can read into an empty buffer as validation of args as
  part of C-VALIDATE
- Do basic read using `Take::read_to_end` since it is currently
  untested.
2025-01-13 09:16:47 +11:00
merge-script 9a03d6b614
Merge rust-bitcoin/rust-bitcoin#3895: Automated nightly rustfmt (2025-01-12)
8bdd67a368 2025-01-12 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 8bdd67a368fd1613c7babeed85fecbf20ba820ad; successfully ran local tests

Tree-SHA512: c408f90b2df821f4b940e1c99a85f1c7bc4f4983b2f39ebe15bb2ff8a4620ef4196f28f3ee2ce791dbd2a71f050ff841df455be6cba148c5278541a10bbca826
2025-01-12 17:44:57 +00:00
Fmt Bot 8bdd67a368 2025-01-12 automated rustfmt nightly 2025-01-12 01:23:13 +00:00
Tobin C. Harding cee2308586
Merge rust-bitcoin/rust-bitcoin#3892: Automated daily update to rustc (to nightly-2025-01-10)
a431a13c24 Automated update to Github CI to rustc nightly-2025-01-10 (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 a431a13c24

Tree-SHA512: 390ba1676cb1532e6ef355e505f11989176b75bb56ad6ae39ed40973a70990fd073a9ac7c5835d39f36855e0ef87d19c092af1d9ff31f49c441e58e1561238a2
2025-01-12 09:12:31 +11:00
merge-script 93cd9a4f74
Merge rust-bitcoin/rust-bitcoin#3891: typo: `Address::is_valid_for_network`
1e0c065740 typo: Address::is_valid_for_network (Jose Storopoli)

Pull request description:

  I believe this is a typo.

ACKs for top commit:
  apoelstra:
    ACK 1e0c065740266a8ad207a95f4d964394ba3f07d7; successfully ran local tests
  tcharding:
    ACK 1e0c065740

Tree-SHA512: aff71b91dc707c0c6c723e35510d284fd9a60895b7f12828819eb0d4520216491a2cf054b59872ac4be175d566674a32bde8c170f43beb6fc15dd19e6be12e45
2025-01-11 16:01:15 +00:00
merge-script 6a4ca4e61a
Merge rust-bitcoin/rust-bitcoin#3878: bitcoin: Add an example of doing I/O to encode/decode
706a135de6 bitcoin: Add an example of doing I/O to encode/decode (Tobin C. Harding)

Pull request description:

  In an effort to improve the documentation on `bitcoin_io` add an example in `bitcoin` crate that demonstrates a few things:

  - Encode/Decode a `rust-bitcoin` type to/from a stdlib type.
  - Encode to a custom type by implementing `bitcoin_io` traits.
  - Encode to a foreign custom type by using the `bitcoin_io::bridge::FromStd` wrapper.

  Later we can link to this example online in the `bitcoin_io` docs.

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

Tree-SHA512: cd3ff4067d5b86031255cb31fe17dea3fd22479699d32efad93c359de465ef6250f29aa4c43ce4218ae623fa6c355661960c11908a729a895655319141b82852
2025-01-11 14:46:13 +00:00
Update Nightly Rustc Bot a431a13c24 Automated update to Github CI to rustc nightly-2025-01-10 2025-01-11 01:41:39 +00:00
merge-script 1d1fcb0c52
Merge rust-bitcoin/rust-bitcoin#3861: io: Add traits
426f585a47 api: Run just check-api (Tobin C. Harding)
6cf90132bc io: Add traits (Tobin C. Harding)

Pull request description:

  So that our `io` crate is not surprising it seems we should generally, unless there is a good reason not to, follow `std::io`.

  Copy the derived trait implementations from `std::io` for `Cursor`, and `Sink`. `Take` is correct already, just `Debug`.

  Done while investigating C-COMMON-TRAITS

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

Tree-SHA512: 0fdacfa0295c36e9ee2bdffd5e649b923f48eeff7baa3afc99fda0836ae30b794610a176c0e76341a268c712baab51139355976c23913a0744692cd1e38a4d11
2025-01-10 16:06:21 +00:00
Jose Storopoli 1e0c065740
typo: Address::is_valid_for_network
I believe this is a typo.
2025-01-10 11:11:43 -03:00
Update Stable Rustc Bot e8b157317e Automated update to Github CI to rustc stable-1.84.0 2025-01-10 00:57:18 +00:00
merge-script 67db64cd97
Merge rust-bitcoin/rust-bitcoin#3885: io: Allow setting position bigger than inner buffer
e315aaf1c6 io: Allow setting position bigger than inner buffer (Tobin C. Harding)

Pull request description:

  Currently if one calls `set_position` on a cursor setting the position greater than the total length of the inner buffer future calls to `Read` will panic. Bad `Cursor` - no biscuit.

  Mirror the stdlib `Cursor` and allow setting the position to any value. Make reads past the end of the buffer return `Ok(0)`.

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

Tree-SHA512: 71b151218e96343a86c8b2c21c6e8212e2d1c2aea6517b4662da3ad01b3b598cec497028b863a8e36a6b1fae1d4f7f975c8610c3b6f39f1c256adc5751d06ea0
2025-01-10 00:56:43 +00:00
merge-script 57469bf041
Merge rust-bitcoin/rust-bitcoin#3889: Reorder assertions in units::amount::tests to follow got, want order
7a3df57659 Reorder assertions in units::amount::tests to follow got, want order (yhzlsm)

Pull request description:

  Reorder assertions in `units::amount::tests` to follow got, want order.

  Makes debugging easier, as there's no need to check the test to verify the order.

  Close #3860

ACKs for top commit:
  tcharding:
    ACK 7a3df57659
  apoelstra:
    ACK 7a3df57659d02ab610e328072435836386ed1c97; successfully ran local tests

Tree-SHA512: 7d07162ba930ca1471684a771cad08ba9153b0b38bf44c98fd41c2d70f05c36b95f022dd82e61e6b50614266f16a5615edd79d6d548b003642509866416021c9
2025-01-09 22:34:20 +00:00
merge-script 52f05869d9
Merge rust-bitcoin/rust-bitcoin#3813: Refactor fee calculation code
9d1cba4994 units: Introduce fee module (Tobin C. Harding)
cd908fec51 Use explicit calc getters and setters (Tobin C. Harding)

Pull request description:

  We have a bunch of functions and impl blocks scattered around the place for calculating fee from fee rate and weight.

  In an effort to make the code easier to read/understand and also easier to audit introduce a private `fee` module and move all the code that is related to this calculation into it.

  This is in internal change only.

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

Tree-SHA512: a33c1ce4a1b62ff29ee65dd3adf2f19384a77f7e18f1c42019973631726cd710c2c8d9c200afb108d4f3f34fcce5cd5383a7ae512caf76c73604db9cdf9eaeda
2025-01-09 20:58:18 +00:00
merge-script 653ea702d6
Merge rust-bitcoin/rust-bitcoin#3792: Add BIP324 V2 p2p network message support
e09bdb5f98 Add BIP324 V2 p2p network message support (Nick Johnson)

Pull request description:

  Migrating over the BIP324's library's V2 network message encoding and decoding. As discussed over in https://github.com/rust-bitcoin/rust-bitcoin/discussions/2959, this is probably the natural home for it and also cleans up some gross copy/pasta of some of the encoding/decoding chain logic.

  This patch adds `V2NetworkMessage` which wraps a `NetworkMessage`, but handles the V2 encoding and decoding. It is a parallel of the existing `RawNetworkMessage` (which mentioned before, may be better described as `V1NetworkMessage` https://github.com/rust-bitcoin/rust-bitcoin/issues/3157). A priority of this patch was to not re-invent any wheels and try to use the existing patterns as much as possible.

ACKs for top commit:
  tcharding:
    ACK e09bdb5f98
  apoelstra:
    ACK e09bdb5f98ea516382a04283373ad97a41d57c2b; successfully ran local tests; nice!

Tree-SHA512: a5078d4d3deb04c2e06ea513bbc8c97d0e6d5da5b029847a97b3f90bf55a263858dd16d88299f853aa3c468f7b9bceb3973c5652a49d3e96df3e91181b455f29
2025-01-09 18:46:39 +00:00
merge-script 9a8e61393c
Merge rust-bitcoin/rust-bitcoin#3858: Bound `Address` parsing on `NetworkValidationUnchecked`
29a71de928 Bound Address parsing on NetworkValidationUnchecked (Tobin C. Harding)
cf455d3a06 Fix typo in prifixes (Tobin C. Harding)

Pull request description:

  Currently it is not possible for downstream to use a generic on the `Address` type in structs in conjuncture with
  derives (`serde::Deserialize` and `Display`) because our impls are only done for `NetworkUnchecked` (as they should be).

  However, as observed by dpc, if we add a secondary marker trait and use it to bound the impls, implementing the new marker for `NetworkUnchecked` then downstream can use derives by way of

  ```
      #[derive(Serialize, Deserialize)]
      struct Foo<V>
          where V: NetworkValidation,
      {
          #[serde(bound(deserialize = "V: NetworkValidationUnchecked"))]
          address: Address<V>,
      }
  ```

  This is cool as hell because the `Address` type is currently a royal PITA.

  Patch 1 is trivial cleanup.

  To get past a build error in `FromStr` I used this little trick
  ```rust
              // We know that `U` is only ever `NetworkUnchecked` but the compiler does not.
              Ok(Address(address.0, PhantomData::<U>))
  ```

  Resolve: #3760
  and
  Close: #3856

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

Tree-SHA512: 7c158dddb9fdbaaa1e48204bbf915b18ced56f5d82ce82630db6c0b52161bcf43b3ac413fa990a23975743c56917985b2666a74f9067221f003f2dcf080f827e
2025-01-09 16:36:13 +00:00
merge-script d36ccea6c4
Merge rust-bitcoin/rust-bitcoin#3884: units: Refactor Send/Sync api test
96f427a8b8 units: Refactor Send/Sync api test (Tobin C. Harding)

Pull request description:

  The `api` test for types implementing `Send` and `Sync` is part of both C-SEND-SYNC and also C-GOOD-ERR (for error types).

  Refactor the two tests into a single one and document appropriately. This is mirrors how we do it in `io/tests/api.rs`.

ACKs for top commit:
  apoelstra:
    ACK 96f427a8b84129179e86f3914be8e4712a89f660; successfully ran local tests; lgtm

Tree-SHA512: 7b24780ac2b4f73d0cad952555f005553d9b8c248da6f92c28e7e9510b58eba6c165720ded9bd2f2db19f9a19d72fe7dd333e68312f1291a47e044a94902be0b
2025-01-09 15:54:09 +00:00
Tobin C. Harding 426f585a47
api: Run just check-api 2025-01-09 15:42:25 +11:00
Tobin C. Harding 6cf90132bc
io: Add traits
So that our `io` crate is not surprising it seems we should generally,
unless there is a good reason not to, follow `std::io`.

Copy the derived trait implementations from `std::io` for `Cursor`,
`Sink`, and `Take`.

Done while investigating C-COMMON-TRAITS
2025-01-09 15:41:37 +11:00
yhzlsm 7a3df57659 Reorder assertions in units::amount::tests to follow got, want order
Reorder assertions in `units::amount::tests` to follow got, want order

Makes debugging easier, as there's no need to check the test to verify the order.
2025-01-08 21:18:32 -03:00