rust-bitcoin-unsafe-fast/bitcoin
Andrew Poelstra 0de8ec5b19
Merge rust-bitcoin/rust-bitcoin#2076: Re-write the weight/size API
c34e3cc7cc Re-write size/weight API (Tobin C. Harding)
73f7fbf520 Add code comments to transaction serialization (Tobin C. Harding)
29f20c1d0b Add segwit serialization constants (Tobin C. Harding)

Pull request description:

  Audit and re-write the weight/size API for `Block` and `Transaction`. First two patches are trivial, patch 3 contains justification and explanation for this work, copied here:

  ```
      Recently we introduced a bug in the weight/size code, while
      investigating I found that our `Transaction`/`Block` weight/size APIs
      were in a total mess because:

      - The docs were stale
      - The concept of weight (weight units) and size (bytes) were mixed up

      I audited all the API functions, read some bips (141, 144) and re-wrote
      the API with the following goals:

      - Use terminology from the bips
      - Use abstractions that mirror the bips where possible
  ```

  Please note, this PR introduces panics if a sciptPubkey overflows the calculation `weight = spk.size() * 4`.

  Fix #2049

ACKs for top commit:
  apoelstra:
    ACK c34e3cc7cc
  sanket1729:
    ACK c34e3cc7cc.

Tree-SHA512: 4944f652e6e362a282a5731140a9438a82d243a4c646b4627d9046a9f9cf13c476881750d432cfbc6b5fe5de1f0c4c9c44ed4569dac4bc11b55a5db28793803c
2023-09-26 20:08:56 +00:00
..
contrib hashes: Bump version to 0.13.0 2023-08-24 12:25:42 +10:00
embedded Add patch section to test crates 2023-07-18 10:27:48 +10:00
examples Merge pull request #2006 from tcharding/08-18-tx-version 2023-09-23 13:13:52 -05:00
src Merge rust-bitcoin/rust-bitcoin#2076: Re-write the weight/size API 2023-09-26 20:08:56 +00:00
tests Merge pull request #2006 from tcharding/08-18-tx-version 2023-09-23 13:13:52 -05:00
CHANGELOG.md Add changelog entries 2023-09-25 07:44:26 +10:00
Cargo.toml Use the new bech32 iterator API 2023-09-21 15:10:57 +10:00
build.rs Remove rust_v_1_46 2023-03-23 08:27:10 +11:00