]> Untitled Git - bdk-cli/commitdiff
Merge bitcoindevkit/bdk-cli#326: fix transaction creation input validation and fee... master github/master
authormerge-script <withtvpeter@gmail.com>
Mon, 28 Sep 2026 19:28:11 +0000 (20:28 +0100)
committermerge-script <withtvpeter@gmail.com>
Mon, 28 Sep 2026 19:28:11 +0000 (20:28 +0100)
12825537460a9bffb8593ca9f78968e912117ae6 fix(fee_rate): parse fee_rate at clap and keep sub-sat/vB precision (Vihiga Tyonum)
3e7db1b03d9e7954c3d9208ae0eaa0835f8b0c2f fix(create_tx,bump_fee): return errors instead of panicking (Vihiga Tyonum)

Pull request description:

  <!-- You can erase any parts of this template not applicable to your Pull Request. -->

  ### Description

  This PR addresses input-validation problems on the transaction-building commands (create_tx, create_sp_tx, bump_fee), transaction fee rate and OP_RETURN data size:
  - Panics on malformed input:  `create_tx` and `bump_fee` called `.unwrap()` on Results so they panic (exit 101) instead of an error (exit 1).
  -  The `create_sp_tx` already guarded these paths, but improvements were made to the error type been returned
  - Fee rates: `--fee_rate` was an `f32` cast with `as u64`, which truncates and saturates, and a `None` from `from_sat_per_vb` was silently skipped. Parsing now happens in a `value_parser`, so bad values are rejected with
  a usage message before a wallet is loaded. Because `FeeRate` counts sat/kwu, fractional rates keep 1/250 sat/vB precision instead of being truncated .
  - OP_RETURN size: Both `--add_data` and `--add_string` document "max 80 bytes" and neither enforced it. This has now been updated to 100_000 bytes and enforced in transaction building.
  - `create_dns_tx` was had the same fee-rate bug and the same OP_RETURN handling, and has been fixed too.
  - `bump_fee --utxos` and `send_payjoin -f` are fixed by the same changes.

  Fixes #325

  <!-- Describe the purpose of this PR, what's being adding and/or fixed -->

  ### Notes to the reviewers

  <!-- In this section you can include notes directed to the reviewers, like explaining why some parts
  of the PR were done in a specific way -->

  ## Changelog notice

  - Fixed `create_tx` and `bump_fee` panicking on malformed `--utxos` and `--add_data` values instead of returning an error
  - Fixed `--fee_rate` silently truncating to a whole sat/vB, falling back to a default, or producing a zero-fee transaction; unusable values are now rejected
  - Enforced the documented 100_000 byte limit on `--add_data` and `--add_string` OP_RETURN payloads

  <!-- Notice the release manager should include in the release tag message changelog -->
  <!-- See https://keepachangelog.com/en/1.0.0/ for examples -->

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk-cli/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### Bugfixes:

  * [ ] This pull request breaks the existing API
  * [x] I've added tests to reproduce the issue which are now passing
  * [x] I'm linking the issue being fixed by this PR

ACKs for top commit:
  vadim-anfv:
    tACK 12825537460a9bffb8593ca9f78968e912117ae6

Tree-SHA512: 1af47f15be8cc66194cf0c87da665cd3783b2cf262c80c004aa2e49bec100b3e41c8d113f18dbba5c5b309a1606e215accb0e3f762fc67190cda4853f20fa416


Trivial merge