rust-bitcoin-unsafe-fast/primitives
merge-script 294a58c3f9
Merge rust-bitcoin/rust-bitcoin#4128: Remove `From<hash>` for not-general-hash types
db9ec3bed8 Remove From<newtype> for $hash (Tobin C. Harding)
6b2b89c2f7 Remove From<hash> for not-general-hash types (Tobin C. Harding)
200ff47327 Use compute_merkle_root (Tobin C. Harding)

Pull request description:

  The `hash_newtype` macro is explicitly designed to produce a hash that is not a general purpose hash type to try and prevent users hashing arbitrary stuff with it. E.g., `Txid` isn't meant to be just hash arbitrary data. However we provide a `From` impl that will convert any instance of the inner hash type into the new type. This kind of defeats the purpose. We provide `from_byte_array` and `to_byte_array` to allow folk to 'cast' from one hash type to another if they really want to and its ugly on purpose.

  Also, it is becoming apparent that we may be able to remove the `hashes` crate from the public API of `primitives` allowing us to stabalise `primitives` without stabalising `hashes`.

  For both these reasons remove the `From` impl from the `hash_newtype` macro. Note that deprecating doesn't seem to work so we just delete it.

ACKs for top commit:
  Kixunil:
    ACK db9ec3bed8
  apoelstra:
    ACK db9ec3bed8d6164a0345ba8db1e2162626db7cc5; successfully ran local tests

Tree-SHA512: 90bc325821cd2d72bbaef5b3cfef2d299192d1e7999cd4f96b6b69b8872e419964e431e91674c59bfdd2e9a5959dbc13ee89d5f87d03e96785044c616db19d72
2025-03-21 15:49:01 +00:00
..
contrib Remove rust-ordered dependency 2025-02-18 13:36:07 +11:00
src Merge rust-bitcoin/rust-bitcoin#4128: Remove `From<hash>` for not-general-hash types 2025-03-21 15:49:01 +00:00
CHANGELOG.md Bump version of bitcoin-primitives to 0.101.0 2024-11-15 10:58:46 +11:00
Cargo.toml Remove references to cfg(mutate) from lint allow - no longer allowed 2025-03-10 12:45:57 +08:00
README.md Move Witness to primitives 2024-10-18 14:02:03 +11:00

README.md

Rust Bitcoin - primitive types.

This crate provides primitive data types that are used throughout the rust-bitcoin ecosystem.

Semver compliance

Functions marked as unstable (e.g. foo__unstable) are not guaranteed to uphold semver compliance. They are primarily provided to support rust-bitcoin.

Minimum Supported Rust Version (MSRV)

This library should always compile with any combination of features on Rust 1.63.0.

Licensing

The code in this project is licensed under the Creative Commons CC0 1.0 Universal license. We use the SPDX license list and SPDX IDs.