rust-bitcoin-unsafe-fast/primitives
merge-script fab1a97a9c
Merge rust-bitcoin/rust-bitcoin#4061: Make Debug representation of Witness to be slice of hex-encoded bytes strings to improve readability
8d8edd2c77 make Debug representation of Witness to be slice of hex-encoded bytes strings (Erick Cestari)

Pull request description:

  This PR updates the Debug implementation for the Witness type to improve its readability by displaying the witness data as a slice of hex-encoded strings rather than a concatenated blob or list of raw u8 values. The changes include:

  - Improved Output:
  The debug output now shows pseudo-fields such as the number of elements and the total length of all elements, making it easier to understand the underlying data without exposing internal indices like indices_start.

  - Hex-Encoding:
  Each witness element is displayed as a hex-encoded string, similar to Bitcoin Core's output style, which enhances clarity during debugging sessions.

  These changes should provide a more developer-friendly view of the witness data and align with similar patterns used elsewhere in the ecosystem.

  Closes #4023.

  Example display:

  ```
  Witness {
      num_elements: 3,
      total_bytes: 5,
      elements: [
          0b,
          1516,
          1f20,
      ],
  }
  ```
  ```
  Witness { num_elements: 3, total_bytes: 5, elements: [0b, 1516, 1f20] }
  ```

ACKs for top commit:
  tcharding:
    ACK 8d8edd2c77
  Kixunil:
    ACK 8d8edd2c77
  apoelstra:
    ACK 8d8edd2c77de9b0423533fc70802171803761fcd; successfully ran local tests

Tree-SHA512: ffcdf67542049f405317eecd74876b51972d27ec552eec8e9c7b6324f18f31f4721fc4d2be1e596232c39af90a8d169c082f9b0636e5aa1a80fe1b063d645456
2025-02-17 23:21:39 +00:00
..
contrib Implement Arbitrary for Transaction 2024-09-16 22:02:46 -05:00
src Merge rust-bitcoin/rust-bitcoin#4061: Make Debug representation of Witness to be slice of hex-encoded bytes strings to improve readability 2025-02-17 23:21:39 +00:00
CHANGELOG.md Bump version of bitcoin-primitives to 0.101.0 2024-11-15 10:58:46 +11:00
Cargo.toml Invert dependency between io and hashes 2025-02-11 09:17:21 +11: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.