rust-bitcoin-unsafe-fast/bitcoin
Andrew Poelstra c53402790e
Merge rust-bitcoin/rust-bitcoin#2255: Fix: TxOut::minimal_non_dust and Script::dust_value
1b23220d10 Fix: TxOut::minimal_non_dust and Script::dust_value (Jonathan Underwood)

Pull request description:

  Fixes #2192

  TxOut::minimal_non_dust has 3 problems.

  1. There is an invisible dependency on Bitcoin Core's default minrelaytxfee value. It has been made explicit.
  2. There is an off by one error. The dust limit comparison uses < and therefore `+ 1` was not needed. It has been fixed.
  3. It was not returning 0 amount for OP_RETURN outputs.

  Script::dust_value has 2 problems.

  1. The dust amount depends on minrelaytxfee which is configurable in Bitcoin Core. This method was not configurable.
  2. The division operation was done before multiplying the byte amount, which can cause small differences when using uncommon scripts and minrelaytxfee values.

ACKs for top commit:
  Kixunil:
    ACK 1b23220d10
  apoelstra:
    ACK 1b23220d10

Tree-SHA512: eafd5112fbf773d86e094e3a69c519dd32f5074f5c9c63a8d69b1c9796579a8f2c2d11ad0995d8252c25b7fed5cd7c968ab88a70588986981a0a63649d43e197
2023-12-11 13:24:16 +00:00
..
contrib bitcoin: Add DO_FEATURE_MATRIX 2023-12-06 10:09:05 +11:00
embedded Remove no-std feature 2023-12-06 09:54:33 +11:00
examples bitcoin: Add signing examples 2023-10-31 10:11:48 +11:00
src Merge rust-bitcoin/rust-bitcoin#2255: Fix: TxOut::minimal_non_dust and Script::dust_value 2023-12-11 13:24:16 +00:00
tests Remove imports of TryFrom and TryInto 2023-11-24 03:52:05 +11:00
CHANGELOG.md Remove no-std feature 2023-12-06 09:54:33 +11:00
Cargo.toml Remove no-std feature 2023-12-06 09:54:33 +11:00
build.rs Bump MSRV to Rust version 1.56.1 2023-11-23 06:20:02 +11:00