Skip to content

create_tx panics on malformed input instead of returning an error; fee-rate parsing silently truncates or falls back #325

Closed

Description

@tvpeter

Describe the bug

CreateTxCommand and BumpFeeCommand call .unwrap() on Results that carry user-supplied input, so a mistyped argument aborts the process with a Rust panic (exit 101) instead of a usage error (exit 1).
Also, related is the fee_rate in create_tx, create_sp_tx, and bump_fee where the --fee_rate is taken as f32 and cast it with
as u64. The cast is saturating and truncating, and when FeeRate::from_sat_per_vb returns None the if let Some is simply skipped (or unwrap_or(FeeRate::BROADCAST_MIN) in bump_fee), so the user silently gets a fee they did not ask for.

To Reproduce

$ADDR is any valid testnet address.

# control — normal error path, exit 1
bdk-cli --network testnet wallet --wallet repro create_tx --to "$ADDR:10000"
# Error: Create transaction error: Insufficient funds: 0 BTC available of 0.00010054 BTC needed

# E1 — unknown outpoint, exit 101
bdk-cli --network testnet wallet --wallet repro create_tx --to "$ADDR:10000" \
  --utxos aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:0
# thread 'main' panicked at src/handlers/offline.rs:291:46:
# called `Result::unwrap()` on an `Err` value: UnknownUtxo(OutPoint { txid: aaaa…, vout: 0 })

# E2 — malformed base64, exit 101
bdk-cli --network testnet wallet --wallet repro create_tx --to "$ADDR:10000" \
  --add_data '!!!not-base64!!!'
# thread 'main' panicked at src/handlers/offline.rs:299:70:
# called `Result::unwrap()` on an `Err` value: InvalidByte(0, 33)

Expected behavior

A graceful error on any failure instead of panic

Build environment

  • BDK-CLI tag/commit: v4.0.0 5b3cb00

Activity

  1. added
    bug
    on Sep 16, 2026
  2. self-assigned this
    on Sep 16, 2026
  3. added theissue type on Sep 16, 2026
  4. added 3 commits that reference this issue on Sep 26, 2026
    3e7db1b
    3eacd05
    1282553
  5. added a commit that references this issue on Sep 28, 2026
    39d0d2a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions