]> Untitled Git - bdk-cli/commit
fix(fee_rate): parse fee_rate at clap and keep sub-sat/vB precision
authorVihiga Tyonum <withtvpeter@gmail.com>
Sat, 26 Sep 2026 08:22:34 +0000 (09:22 +0100)
committerVihiga Tyonum <withtvpeter@gmail.com>
Mon, 28 Sep 2026 17:35:43 +0000 (18:35 +0100)
commit12825537460a9bffb8593ca9f78968e912117ae6
tree0a967e4bdf7162128b85185587be987da0723868
parent3e7db1b03d9e7954c3d9208ae0eaa0835f8b0c2f
fix(fee_rate): parse fee_rate at clap and keep sub-sat/vB precision

`--fee_rate` was taken as `f32` in the tx-building commands and cast
`as u64`, which both truncates and saturates. When `FeeRate::from_sat_per_vb`
returned `None` the value was silently skipped in `create_tx`, `create_sp_tx`
and `create_dns_tx`, `bump_fee` fell back to `FeeRate::BROADCAST_MIN`, and
`send_payjoin` took a `u64` and panicked, so the user got a fee they never
asked for or no transaction at all.

- add `parse_fee_rate` and pass it as a clap `value_parser`, so invalid
  values are rejected
- store `FeeRate` instead of `f32`/`u64`, converting via sat/kwu so
  fractional rates keep 1/250 sat/vB precision rather than truncating
- drop the `unwrap_or(FeeRate::BROADCAST_MIN)` fallback in `bump_fee` and
  the `expect` in `send_payjoin`
- cover parsing and rejection with unit and integration tests

Fixes #325
CHANGELOG.md
src/error.rs
src/handlers/dns/mod.rs
src/handlers/offline.rs
src/handlers/online.rs
src/handlers/payjoin/mod.rs
src/utils/common.rs
tests/integration/offline.rs