Commit Graph

534 Commits

Author SHA1 Message Date
Andrew Poelstra 23d80bf1ab
Merge rust-bitcoin/rust-bitcoin#1764: Test with minimal dependency versions
c4c64c0dc5 Test with minimal dependency versions (Martin Habovstiak)
d5655d503a Bump core2 dependency from 0.3.0 -> 0.3.2 (Tobin C. Harding)

Pull request description:

  This is work originally done by Kixunil in #1272, I picked it up to help out. The only changes I made were rebasingg, updating the recent lock file, adding `--locked` to hashes contrib file,  and adding a co-developed-by tag for accountability.

  It could happen that we unknowingly depend on a new version of a crate without updating `Cargo.toml`. This could cause resolution issues for downstream users. It's also unclear for outsiders to know with which dependencies did we test the crate.

  This change commits two lock files: `minimal` and `recent`. `minimal` contains minimal dependency versions, while `recent` contains dependency versions at the time of making the change.

  Further, this adds CI jobs to test with both lock files, CI job for `internals` crate, removes old `serde` pinning and prints a warning if `recent` is no longer up to date. (We may have to override it somehow if any crate breaks MSRV.)

  The documentation is also updated accordingly.

  Closes #1230

ACKs for top commit:
  apoelstra:
    ACK c4c64c0dc5
  Kixunil:
    ACK c4c64c0dc5

Tree-SHA512: 7d386e96ab747f6a6bafeea828ac65bd8bb11975eaa3408acecac369cd2f235f6e9d4c57202be18a3dc2eeb2a2df532d73e4d35cd1f3fbf092eb6414c55b1524
2023-05-03 22:35:21 +00:00
Martin Habovstiak c4c64c0dc5
Test with minimal dependency versions
It could happen that we unknowingly depend on a new version of a crate
without updating `Cargo.toml`. This could cause resolution issues for
downstream users. It's also unclear for outsiders to see which
dependencies we tested the crate with.

This change commits two lock files: `minimal` and `recent`. `minimal`
contains minimal depdendency versions, while `recent` contains
dependency versions at the time of making the change.

Further, this adds CI jobs to test with both lock files, CI job for
`internals` crate, removes old `serde` pinning and prints a warning if
`recent` is no longer up to date. (We may have to override it somehow if
any crate breaks MSRV.)

The documentation is also updated accordingly.

Co-developed-by: Tobin C. Harding <me@tobin.cc>

Closes #1230
2023-05-03 08:06:46 +10:00
Andrew Poelstra 67ff453a3a
Merge rust-bitcoin/rust-bitcoin#1801: Adds as_core_arg serde module to network
aa6a3530a6 Adds as_core_arg serde module to network (Sergi Delgado Segura)

Pull request description:

  The new module provides serde functions to convert from/to Bitcoin Core network variants.

  Fixes #1799

ACKs for top commit:
  Kixunil:
    ACK aa6a3530a6
  tcharding:
    ACK aa6a3530a6
  sanket1729:
    ACK aa6a3530a6

Tree-SHA512: f536d0e41144928b71dc9b58735d4e0b883ee84a7a84e868f1d74b284c2e2be746ddcb30028dd099515bc933e7efa2cf26717f506edde84c40c3f523a5a8ed27
2023-05-02 01:45:41 +00:00
Andrew Poelstra 936f2ee3bb
Merge rust-bitcoin/rust-bitcoin#1825: Simplify per-file license comments
1c3bbd4bf2 internals: Remove attribution from all files (Tobin C. Harding)
99673ab5c4 hashes: Introduce SPDX license identifiers (Tobin C. Harding)
984fe69448 bitcoin: Remove attribution from all files (Tobin C. Harding)

Pull request description:

  Please note, whether or not we need a per-file license comment is out of scope for this PR. This PR leaves us with the most simple per-file solution possible and leaves the merit of per-file license comment to be discussed on another day.

  Simplify the per-file license stuff by doing:

  - Remove the attribution line from each file.

      Currently we have a mishmash of attribution lines accompanying the SPDX identifier. These lines are basically meaningless because:

      - The date is often wrong
      - The original author attributed is not the only contributor to a file
      - The term "rust bitcoin developers" is basically just noise

  - Introduce SPDX license identifiers into `hashes` and remove attribution line (ie, make `hashes` uniform with `bitcoin`)

  Required before merge please:

  - [x] ack from apoelstra because as the library original author many of the changes in this PR remove his name
  - [x] ack from Kixunil because he had some concerns in the issue descussion

  Fix: #1816

ACKs for top commit:
  Kixunil:
    ACK 1c3bbd4bf2
  sanket1729:
    ACK 1c3bbd4bf2
  apoelstra:
    ACK 1c3bbd4bf2

Tree-SHA512: c5ac05c5eb23b3b6a760f707c344b22f5871a4dedee4990b1840f57e4cee1d38560ff4507c354bbf29bc8ff05a179d95d7e100fcf19bd93c5362344a352c7b5a
2023-05-01 20:11:53 +00:00
Riccardo Casatta fc7c251502
Move weight constants in the `Weight` type
deprecate constants::MAX_BLOCK_WEIGHT and constants::MIN_TRANSACTION_WEIGHT
to nicely redirect users to the constants in the Weight type
2023-05-01 13:55:14 +02:00
Tobin C. Harding d5655d503a
Bump core2 dependency from 0.3.0 -> 0.3.2
`core2` versions 0.3.0 and 0.3.1 do not work with Rust 1.48.0, set
minimum version to 0.3.2 in the `bitcoin` manifest.
2023-05-01 10:07:43 +10:00
Tobin C. Harding 984fe69448
bitcoin: Remove attribution from all files
Currently we have a mishmash of attribution lines accompanying the SPDX
identifier. These lines are basically meaningless because:

- The date is often wrong
- The original author attributed is not the only contributor to a file
- The term "rust bitcoin developers" is basically just noise

Just remove all the attribution lines and be done with it. While we are
at it add an SPDX line to the few files missing it, whether this license
nonsense is even needed is left as an argument for another day.
2023-05-01 09:22:48 +10:00
Andrew Poelstra ca7c60a09d
Merge rust-bitcoin/rust-bitcoin#1817: Hardcode expected weight in txin_txout_weight_tests
dd4ad9444e Hardcode expected weight in txin_txout_weight_tests (Peter Todd)

Pull request description:

  Rational: the expected weight is fixed so this both ensures we don't accidentally change it somehow, and makes it easier to re-use these test cases in other codebases (eg python-bitcoinlib).

ACKs for top commit:
  apoelstra:
    ACK dd4ad9444e
  tcharding:
    ACK dd4ad9444e
  Kixunil:
    ACK dd4ad9444e

Tree-SHA512: 4769a4bb8695f4f4c95e258bb5f06a232090b14c3d9159d6d5de2d09d7fc934a1b920b90cc09677a88fc0cf37ac21ed27794692dff2c73df4252c9551dc10fc2
2023-04-28 15:39:06 +00:00
Andrew Poelstra c9347cd021
Merge rust-bitcoin/rust-bitcoin#1732: Overhaul fuzzing
2860aae1a5 fuzz: don't fuzz hashes against RustCrypto (Andrew Poelstra)
6467728202 fuzz: disable tests unless 'cfg(fuzzing)' is passed; update README for reproducing failures (Andrew Poelstra)
6e2ee5be66 fuzz: run 'cargo fmt' on all the fuzz targets (Andrew Poelstra)
9cfc0fcd81 fuzz: add contrib/test.sh so we at least 'cargo test' it in CI (Andrew Poelstra)
933ecb19e1 fuzz: fix warnings, clippy lints, 1.48.0 failures (Andrew Poelstra)
fd88e48696 fuzz: remove AFL support (Andrew Poelstra)
ab467cb091 fuzz: make hongfuzz fuzzing the default feature (Andrew Poelstra)
6f754df231 fuzz: add fuzzing README (Andrew Poelstra)
f093765efe fix fuzz.sh and cycle.sh to use generated lists of targets (Andrew Poelstra)
6534f22362 fuzz: auto-generate CI and Cargo.toml files (Andrew Poelstra)
8021034d86 rename travis-fuzz.sh to fuzz.sh; partially patch CI (Andrew Poelstra)
0be75f7edc move hashes/fuzz into main fuzz/ directory (Andrew Poelstra)
5a891dec2d move bitcoin fuzz targets into bitcoin/ subdirectory (Andrew Poelstra)
e3111c748b move bitcoin/fuzz into repo root; add to workspace (Andrew Poelstra)

Pull request description:

  Several big changes here:
  * Moves fuzzing to its own workspace with a `contrib/test.sh` etc so that CI will check that it compiles
  * FIx all warnings, clippy lints, MSRV problems, etc.; mostly move to Rust 2018
  * Merge `hashes/` fuzztests into workspace
  * Rewrite all scripts; add file that auto-generates CI fuzz job and Cargo.toml so we don't have to manually keep these in sync
  * Remove bitrotted and partial AFL support.

  Supercedes #1422

  I suspect the hashes fuzztests will actually fail since we haven't touched them in so long. Will address that if CI fails here.

ACKs for top commit:
  sanket1729:
    ACK 2860aae1a5
  tcharding:
    ACK 2860aae1a5

Tree-SHA512: b1aa3d6fac75fee51966f1d3f3245784e331bdea2a3fa7d6609bc4196c34f81acb7701faf8f269c3741568ea100438f24a2f06e75c8d01cb84c8b22d7886f1dd
2023-04-28 13:26:27 +00:00
Andrew Poelstra 8021034d86
rename travis-fuzz.sh to fuzz.sh; partially patch CI 2023-04-27 00:24:52 +00:00
Andrew Poelstra e3111c748b
move bitcoin/fuzz into repo root; add to workspace
This allows testing the fuzztests and making sure that they compile and
tests pass, etc., just using `cargo test --all` in the root.
2023-04-27 00:24:48 +00:00
Peter Todd dd4ad9444e
Hardcode expected weight in txin_txout_weight_tests
Rational: the expected weight is fixed so this both ensures we don't
accidentally change it somehow, and makes it easier to re-use these test
cases in other codebases (eg python-bitcoinlib).
2023-04-26 22:02:03 +00:00
Peter Todd 8b9ec8eb77
Fix policy link 2023-04-26 21:08:26 +00:00
Tobin C. Harding d37845197f
embedded: Remove error handler
Seems we no longer need an explicit error handler, remove it.

I did not grok the reason (long thread link below) but just removed it
and checked that the embedded crates still ran correctly.

https://github.com/rust-lang/rust/issues/51540)
2023-04-26 14:29:39 +10:00
Andrew Poelstra 967b58dc2a
Merge rust-bitcoin/rust-bitcoin#1810: Spelling and typo fixes
20b812dc66 Spelling and typo fixes (yancy)

Pull request description:

  Fix some types in Transaction.rs and encode.rs

ACKs for top commit:
  apoelstra:
    ACK 20b812dc66
  Kixunil:
    ACK 20b812dc66
  tcharding:
    ACK 20b812dc66

Tree-SHA512: d613189932ecb760be385c4095723501222cc8cec8b25525b58f76f9486d33fe46ab241bd2c098ea141f0fd12bb52abc677eba4a0cf3fe5b40b515bd75c7237c
2023-04-26 00:46:31 +00:00
Andrew Poelstra 84a075d03a
Merge rust-bitcoin/rust-bitcoin#1796: transaction: Rename is_coin_base to is_coinbase
a54e1ceab1 Apply rustfmt (The rustfmt Tyranny)
38d11ce3da ci: Make release CI search for NEXT.RELEASE instead (Steven Roose)
dad3abd20f transaction: Rename is_coin_base to is_coinbase (Steven Roose)

Pull request description:

  Alternative to https://github.com/rust-bitcoin/rust-bitcoin/pull/1795.

  Keep the old method as deprecated and add doc alias. Also change internal usage of the method.

ACKs for top commit:
  tcharding:
    ACK a54e1ceab1
  apoelstra:
    ACK a54e1ceab1

Tree-SHA512: 52d9729bf83da164556d960f8867cb836ff57a0f619da3dd3620efffb28a974aac23b8085863ab0e072a4bdb2f13ac576efa43ad2eec9a271ad044227f4d00a4
2023-04-24 23:14:39 +00:00
The rustfmt Tyranny a54e1ceab1 Apply rustfmt 2023-04-24 18:20:23 +01:00
yancy 20b812dc66 Spelling and typo fixes 2023-04-24 16:51:10 +02:00
Andrew Poelstra 8440d80a5a
Merge rust-bitcoin/rust-bitcoin#1696: Remove `schemars` pin from manifest
6c61e1019e Fix pinning (schemars and MSRV) (Tobin C. Harding)
c8e38d6a5a hashes: Implement JsonSchema for sha256t::Hash<T> (Tobin C. Harding)

Pull request description:

  This has grown due to now including pinning work also done in https://github.com/rust-bitcoin/rust-bitcoin/pull/1736, I decided to do this because the PRs conflict and doing it all here saves accidentally getting out of sync. And  https://github.com/rust-bitcoin/rust-bitcoin/pull/1764 requires this PR.

  - Patch 1 is unchanged
  - Patch 2 now fixes pinning in bitcoin and hashes CI scripts and in the docs of both as well as the manifest stuff relating to `schemars` - phew.

  Fix: #1687

ACKs for top commit:
  Kixunil:
    ACK 6c61e1019e
  apoelstra:
    ACK 6c61e1019e

Tree-SHA512: eae4aa9700817bab6ad444e07709e8b1a4ffb1625e08be6ba399abde38bf6f8e5ea216a0836e2e26dfaddc76c392802cd016738ea6e753a1bca2584d9d2a9796
2023-04-19 22:18:29 +00:00
Steven Roose 38d11ce3da
ci: Make release CI search for NEXT.RELEASE instead 2023-04-19 16:07:03 +01:00
Steven Roose dad3abd20f
transaction: Rename is_coin_base to is_coinbase
Keep the old method as deprecated and add doc alias.
Also change internal usage of the method.
2023-04-19 16:02:59 +01:00
Tobin C. Harding 6c61e1019e
Fix pinning (schemars and MSRV)
Done as is single patch to make sure all the docs and CI are in sync and
correct.

We currently pin the `schemars` dependency using `<=0.8.3` as well as a
the `dyn-clone` transient dependency in the manifest (`hashes` and the
extended test crate). This is incorrect because it makes usage of the
crate klunky (or possibly impossible) if downstream users wish to use a
later version of `schemars`.

Observe also that we do not have to pin `schemars`, we do however have to pin
the `serde` crate if either `serde` or `schemars` features are enabled.
Do so in CI and document in the readme file within hashes.

Currently we have a pin remaining from the old MSRV (`syn` due to use
of `matches!`).

Fix pinning by:

- Remove pin in manifest for `schemars`
- Fix pinning for MSRV in CI and docs (this includes documenting pinning
  requirements for `schemars` feature because it is related to the other
  pin of `serde`) in both `hashes` readme and main repo readme.
2023-04-19 10:17:18 +10:00
Sergi Delgado Segura aa6a3530a6 Adds as_core_arg serde module to network
The new module provides serde functions to convert from/to Bitcoin Core
network variants

Includes tests suggested by @tcharding
2023-04-17 12:28:13 +02:00
Andrew Poelstra 0af8d45e21
Merge rust-bitcoin/rust-bitcoin#1797: Add predict_weight test for witness address types
8f6317fbab Add predict_weight test for witness address types (yancy)

Pull request description:

  Add a predict_weight test for address types with witness data

ACKs for top commit:
  Kixunil:
    ACK 8f6317fbab
  apoelstra:
    ACK 8f6317fbab

Tree-SHA512: 954908f068d6b0e8f7cc6bc6bffd110d490d7165cf2544ff0f936264761cb1f8e4da1e37fd5a6a34fd8b05f8d72817a3b340bbf968b29c9f538f10853347fdf0
2023-04-14 16:08:31 +00:00
yancy 8f6317fbab Add predict_weight test for witness address types 2023-04-14 12:02:37 +02:00
Steven Roose 3d524e06e4
Add Inventory::network_hash() method 2023-04-13 16:23:22 +01:00
Andrew Poelstra e83a2d3422
Merge rust-bitcoin/rust-bitcoin#1742: Use package in manifest and shorten import
fabcde036f Use package in manifest and shorten import (Tobin C. Harding)

Pull request description:

  We can use `package` to rename `bitcoin_hashes` to `hashes` and `bitcoin_internals` to `internals`. This makes imports more terse with no loss of meaning.

ACKs for top commit:
  apoelstra:
    ACK fabcde036f
  Kixunil:
    ACK fabcde036f

Tree-SHA512: bc5bff6f7f6bf3b68ba1e0644a83da014081d8c6c9d578c21cb54fdd56a018f68733dd1135d05b590ba193ed9efd12fa9019182c1fed347e604d8548f6ef9103
2023-04-05 14:20:06 +00:00
Andrew Poelstra 8edfc4597b
Merge rust-bitcoin/rust-bitcoin#1765: unsafe address type conversions
29cb34eed7 Refactor Address struct and its methods (Harshil Jani)

Pull request description:

  Closes #1755

  In this PR the `as_unchecked` is added to the Address struct, which returns a reference to the same address but with the type Address<NetworkUnchecked>.  Similarly, the `assume_checked_ref` is added to Address<NetworkUnchecked>, which returns a reference to the same address but with the type Address.

ACKs for top commit:
  tcharding:
    ACK 29cb34eed7
  apoelstra:
    ACK 29cb34eed7

Tree-SHA512: 75ba40883d9fb31026b0e94e8d3fdcf808ff38a4d10f61f99a1e14ddc48358da86bad44cd78563dc67aa5d39382a5493e73c03891317f361f590e39b6257cb84
2023-04-04 17:40:33 +00:00
Andrew Poelstra 350b413e59
Merge rust-bitcoin/rust-bitcoin#1773: Make `sha256t_hash_newtype!` evocative of the output.
91f45a214f Replace hardcoded values with compile-time hashing (Martin Habovstiak)
095b7958dd Make `sha256t_hash_newtype!` evocative of the output. (Martin Habovstiak)

Pull request description:

  The Rust API guidelines state that macros should be evocative of the
  output, which is a sensible recommendation. We already had this for
  `hash_newtype!` macro but didn't for sha256t version.

  This changes the macro to have this syntax:

  ```rust
  sha256t_hash_newtype! {
      // Order of these structs is fixed.
      /// Optional documentation details here. Summary is auto-generated.
      /*pub*/ struct Tag = raw(MIDSTATE_BYTES, LEN);

      /// Documentation here
      #[hash_newtype(forward)] // optional, default is backward
      /*pub*/ struct HashType(/* attributes allowed here */ _);
  }
  ```

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

  Depends on #1769

  How do you like the syntax? Is weird `struct Foo = bar(..);` acceptable?

ACKs for top commit:
  tcharding:
    ACK 91f45a214f
  apoelstra:
    ACK 91f45a214f

Tree-SHA512: f6b555b20311a4c1cb097bc296c92459f6fbe16ba102d8c977eb2383dbcae3cc8ffce32e3cb771e7e22197fda26379971aa4feaadc5e2e70d37fa690ae8b8859
2023-04-03 18:21:58 +00:00
Andrew Poelstra 142b4fc431
Merge rust-bitcoin/rust-bitcoin#1771: Use slice patterns
873501a85f Use slice patterns (Martin Habovstiak)

Pull request description:

  Some code looks better with slice patterns. This changes `bip32` to use them.

ACKs for top commit:
  apoelstra:
    ACK 873501a85f
  tcharding:
    ACK 873501a85f

Tree-SHA512: 2e91b21d0f943c04f592112f241444ba3b1b1dad47ea6bea162f62cfbcaf98e383257cad144072b3807aaa0c122dabab638ac10b1cc1f5179727a5f05aac0659
2023-04-03 15:48:35 +00:00
Harshil Jani 29cb34eed7 Refactor Address struct and its methods
This commit refactors the Address struct and its methods to improve
its functionality and usability.The AddressInner struct now holds
the payload and network, and the PhantomData<V> type is used to track
the network validation state.

Also as_unchecked and assume_checked_red methods are added to allow
conversion between checked and unchecked network validation state.

Signed-off-by: Harshil Jani <harshiljani2002@gmail.com>
2023-04-03 15:24:45 +05:30
Martin Habovstiak 91f45a214f Replace hardcoded values with compile-time hashing
Previous changes enabled passing the string used as a tag into
`sha256t_hash_newtype!` macro rather than hard-coding midstate. This
commit takes advantage of it and replaces the hard-coded values with
compile-time executed (`const`) hashing.
2023-04-02 17:01:10 +02:00
Martin Habovstiak 095b7958dd Make `sha256t_hash_newtype!` evocative of the output.
The Rust API guidelines state that macros should be evocative of the
output, which is a sensible recommendation. We already had this for
`hash_newtype!` macro but didn't for sha256t version.

This changes the macro to have this syntax:

```rust
sha256t_hash_newtype! {
    // Order of these structs is fixed.
    /// Optional documentation details here. Summary is auto-generated.
    /*pub*/ struct Tag = raw(MIDSTATE_BYTES, LEN);

    /// Documentation here
    #[hash_newtype(forward)] // optional, default is backward
    /*pub*/ struct HashType(/* attributes allowed here */ _);
}
```

Closes #1427
2023-04-02 17:00:52 +02:00
Martin Habovstiak 8b4280d5ef Update clippy MSRV configuration
We've upgraded MSRV but didn't update clippy config, so some things that
could be improved aren't caught by clippy. This updates the config and
fixes the new issues.

I also `rg '1\.41\.1'`ed for interesting changes and found one
additional improvement.
2023-04-02 16:28:10 +02:00
Martin Habovstiak 873501a85f Use slice patterns
Some code looks better with slice patterns. This changes `bip32` to use
them.
2023-04-02 01:08:03 +02:00
Andrew Poelstra 895db71156
Merge rust-bitcoin/rust-bitcoin#1763: Use doc_auto_cfg
a189942c64 Use doc_auto_cfg (Tobin C. Harding)

Pull request description:

  If we use `#![cfg_attr(docsrs, feature(doc_auto_cfg))]` instead of `#![cfg_attr(docsrs, feature(doc_cfg))]` we no longer need to manually mark types with `#[cfg_attr(docsrs, doc(cfg(feature = "std")))]`.

  Sweeeeeet.

  Props to pezcore for the lesson :)

ACKs for top commit:
  apoelstra:
    ACK a189942c64
  Kixunil:
    ACK a189942c64

Tree-SHA512: 1ced1e09f5d1733b362b83ca650d3f52c89eb57e78e8437f74c496d89776548f8c50feab6750352342e2abe680434681de2c126ce36a81dda21397b9695d4d4e
2023-03-30 16:56:49 +00:00
Harshil Jani 046bda321b comparing NetworkUncheck addresses
Signed-off-by: Harshil Jani <harshiljani2002@gmail.com>

implementation of PartialEq<Address> for Address<NetworkUnchecked>

Signed-off-by: Harshil Jani <harshiljani2002@gmail.com>
2023-03-29 11:33:20 +05:30
Tobin C. Harding a189942c64
Use doc_auto_cfg
If we use `#![cfg_attr(docsrs, feature(doc_auto_cfg))]` instead of
`#![cfg_attr(docsrs, feature(doc_cfg))]` we no longer need to manually
mark types with `#[cfg_attr(docsrs, doc(cfg(feature = "std")))]`.

Sweeeeeet.
2023-03-29 14:50:33 +11:00
Andrew Poelstra dc72dfb9f2
Merge rust-bitcoin/rust-bitcoin#1753: Add `ChainHash::from_genesis_block_hash`
ed80df5ebc Add `ChainHash::from_genesis_block_hash` (Martin Habovstiak)

Pull request description:

  This improves readability of converting `BlockHash` into `ChainHash`. It's useful in e.g. Electrum protocol which sends `BlockHash` (serialized backward).

  Closes #1751

ACKs for top commit:
  apoelstra:
    ACK ed80df5ebc
  tcharding:
    ACK ed80df5ebc

Tree-SHA512: b03eb9ca0a1eb38196cc8e43751c2def0d00b463b774003c5319bf56599db598ddd4bb0e2ad0bd3803f21a925135992d421848e7b1ba5e7bab3a405f60fc973c
2023-03-28 01:25:18 +00:00
Tobin C. Harding fabcde036f
Use package in manifest and shorten import
We can use `package` to rename `bitcoin_hashes` to `hashes` and
`bitcoin_internals` to `internals`. This makes imports more terse with
no loss of meaning.
2023-03-28 12:20:04 +11:00
Andrew Poelstra 2e2d5e9e34
Merge rust-bitcoin/rust-bitcoin#1740: create a set of recognized denomination forms
82b6332b91 create a set of recognized denomination forms (yancy)

Pull request description:

  I took a stab at restricting the acceptable forms here.  There was some consensus that "BtC" was confusing that was discussed in a previous pr https://github.com/rust-bitcoin/rust-bitcoin/pull/1715.

  Also, personally I felt that the `PossiblyConfusingDenomination` enum variant was itself confusing.  I think it's probably cleaner to just maintain a list of acceptable forms and treat everything else as unknown.  For now I just created a const of possibly confusing forms.

ACKs for top commit:
  Kixunil:
    ACK 82b6332b91
  apoelstra:
    ACK 82b6332b91

Tree-SHA512: f3c212046e4d8a34ce2d50f34065b1778ae190ca80dd9ad73ef41eb5925705c88c0a764ec149d731eb1735d670c5542415953633a7f3f672d0c1e46b6e004d0b
2023-03-27 19:43:00 +00:00
yancy 82b6332b91 create a set of recognized denomination forms 2023-03-27 11:19:55 +02:00
Martin Habovstiak ed80df5ebc Add `ChainHash::from_genesis_block_hash`
This improves readability of converting `BlockHash` into `ChainHash`.
It's useful in e.g. Electrum protocol which sends `BlockHash`
(serialized backward).

Closes #1751
2023-03-26 10:42:22 +02:00
Andrew Poelstra 531dbc888c
Merge rust-bitcoin/rust-bitcoin#1730: Use shorter imports
122188f7dd Use shorter import statements (Tobin C. Harding)

Pull request description:

  Just patch 2, patch 1 is #1728

  From the commit log of patch 2

      Use shorter import statements

      As per discussion [0] use the shorter form for importing crates that we
      re-export (`hashes` and `secp256k1`).

      [0] https://github.com/rust-bitcoin/rust-bitcoin/discussions/1661

ACKs for top commit:
  apoelstra:
    ACK 122188f7dd
  sanket1729:
    utACK 122188f7dd

Tree-SHA512: 3f540464d38c72ba9d68f8ceda8600540bd0c3eef0ba67531c87fa1e0e4f757af7035cf80a1a5f17aa05604a17fdd9ef59bb6bece6b4145d540dac1e5362fc01
2023-03-23 17:39:03 +00:00
Andrew Poelstra 3417585a53
Merge rust-bitcoin/rust-bitcoin#1729: Bump MSRV to 1.48.0
1dc04fe10f Remove rust_v_1_46 (Tobin C. Harding)
71fa9e81e7 Bump MSRV to 1.48.1 (Tobin C. Harding)

Pull request description:

  Just patch 2, patch 1 is #1728

  From the commit log of patch 2

      Bump MSRV to 1.48.1

      As per discussion [0] bump our MSRV for all crates in `rust-bitcoin`
      repo to 1.48.1 [1].

      [0] https://github.com/rust-bitcoin/rust-bitcoin/discussions/1329
      [1] https://blog.rust-lang.org/2020/11/19/Rust-1.48.html

ACKs for top commit:
  apoelstra:
    ACK 1dc04fe10f
  sanket1729:
    ACK 1dc04fe10f

Tree-SHA512: 533470c55f7aeede88382db8245033dac9317d75b38ced2ad8256d38319632a524335f893044e96300a1e60048f9aaca2d1634735eb324eb8ed9ad3c9ab2f872
2023-03-23 00:50:33 +00:00
Andrew Poelstra 3ca9de82a6
Merge rust-bitcoin/rust-bitcoin#1735: Add kilo weight unit conversion
dbd2ea07b5 Add kilo weight unit conversion (yancy)

Pull request description:

  The FeeRate module defaults to sats per `kwu` so when doing fee calculations, it would be convenient to easily convert weight to the same units.

ACKs for top commit:
  Kixunil:
    ACK dbd2ea07b5
  tcharding:
    ACK dbd2ea07b5
  apoelstra:
    ACK dbd2ea07b5

Tree-SHA512: fe26b631cf474f1dca627a4d21e9052c80f8ada9a0eb635c46b7f8f42095671b9b161fb5012b723699008372faf7668507d5e92bde7d1808d389f85dba33529b
2023-03-23 00:11:12 +00:00
Tobin C. Harding 1dc04fe10f
Remove rust_v_1_46
We just bumped the MSRV to 1.48.0 so we know that we have all features
from 1.46, no need for `rust_v_1_46` check anymore.
2023-03-23 08:27:10 +11:00
Tobin C. Harding 71fa9e81e7
Bump MSRV to 1.48.1
As per discussion [0] bump our MSRV for all crates in `rust-bitcoin`
repo to 1.48.1 [1].

[0] https://github.com/rust-bitcoin/rust-bitcoin/discussions/1329
[1] https://blog.rust-lang.org/2020/11/19/Rust-1.48.html
2023-03-23 08:03:06 +11:00
yancy dbd2ea07b5 Add kilo weight unit conversion 2023-03-22 20:05:07 +01:00
Tobin C. Harding 122188f7dd
Use shorter import statements
As per discussion [0] use the shorter form for importing crates that we
re-export (`hashes` and `secp256k1`).

[0] https://github.com/rust-bitcoin/rust-bitcoin/discussions/1661
2023-03-22 14:09:58 +11:00