You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
create_tx panics on malformed input instead of returning an error; fee-rate parsing silently truncates or falls back #325
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)
Activity
fix(create_tx,bump_fee): return errors instead of panicking
fix(fee_rate): parse fee_rate at clap and keep sub-sat/vB precision
fix(fee_rate): parse fee_rate at clap and keep sub-sat/vB precision
Merge bitcoindevkit#326: fix transaction creation input validation an…