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

Aperta
#325 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@tvpeter ci sta già lavorando.

Dal 16/9/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug

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
Lingua principale
Rust
Stelle
142
Fork
99
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bitcoindevkit/bdk-cli

Tutte le issue di bitcoindevkit/bdk-cli

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.