Skip to content

feat(wasm-utxo): add max_fee_rate param to PSBT extract_transaction#308

Open
OttoAllmendinger wants to merge 1 commit into
masterfrom
otto/T1-3656-extract-maxfeerate-param
Open

feat(wasm-utxo): add max_fee_rate param to PSBT extract_transaction#308
OttoAllmendinger wants to merge 1 commit into
masterfrom
otto/T1-3656-extract-maxfeerate-param

Conversation

@OttoAllmendinger

Copy link
Copy Markdown
Contributor

Summary

Adds an optional max_fee_rate parameter to the PSBT extract path in wasm-utxo so callers can override rust-bitcoin's BTC-calibrated absurd-fee-rate guard, which rejects valid high-fee transactions on low-unit coins like Dogecoin (T1-3656).

This is pure plumbing — no per-coin fee policy is introduced here. The per-coin default thresholds and fees namespace land in a follow-up that builds on this.

Changes

  • Rust: new ExtractFeePolicy enum (Default | Unchecked | Limited(FeeRate)) plus extract_tx_with_fee_policy / extract_bitcoin_tx_with_fee_policy / extract_dash_tx_with_fee_policy / extract_zcash_tx_with_fee_policy. The existing no-arg extract_*_tx methods delegate with Default, preserving current behavior.
  • wasm-bindgen: extract_transaction (and the bitcoin/dash/zcash variants) take max_fee_rate_sat_per_vb: Option<f64>. undefinedDefault, InfinityUnchecked (skip the guard), finite → Limited.
  • JS wrappers: BitGoPsbt.extractTransaction(maxFeeRate?) and ZcashBitGoPsbt.extractTransaction(maxFeeRate?) forward the value.

Units

The entire API is in sat/vB — the same unit as rust-bitcoin's FeeRate — so no conversion happens inside wasm-utxo. Callers that hold sat/kB thresholds (e.g. wallet-platform's maxFeeRateSatPerKB) must divide by 1000 at the callsite before passing.

Test plan

  • cargo build, cargo fmt --check, cargo clippy --all-targets clean
  • All 46 existing extract* tests pass (delegation is behavior-preserving)
  • New test_extract_tx_with_fee_policy_matches_default pins that Default / Unchecked / Limited produce byte-identical output to extract_tx() on a normal-fee PSBT
  • Downstream: ims-utxo / wallet-platform callsites pass maxFeeRateSatPerKB / 1000 (companion PR)

Refs: T1-3656

Add an optional `max_fee_rate` parameter to the PSBT extract path so
callers can override rust-bitcoin's BTC-calibrated absurd-fee-rate
guard, which rejects valid high-fee transactions on low-unit coins
like Dogecoin (T1-3656).

This is pure plumbing — no per-coin fee policy is introduced here:

- Rust: new `ExtractFeePolicy` enum (`Default` | `Unchecked` |
  `Limited(FeeRate)`) plus `extract_tx_with_fee_policy` /
  `extract_bitcoin_tx_with_fee_policy` / `extract_dash_tx_with_fee_policy`
  / `extract_zcash_tx_with_fee_policy`. The existing no-arg `extract_*_tx`
  methods delegate with `Default`, preserving current behavior.
- wasm-bindgen: `extract_transaction` (and the bitcoin/dash/zcash
  variants) take `max_fee_rate_sat_per_vb: Option<f64>`. `undefined` ->
  `Default`, `Infinity` -> `Unchecked` (skip the guard), finite ->
  `Limited`.
- JS wrappers: `BitGoPsbt.extractTransaction(maxFeeRate?)` and
  `ZcashBitGoPsbt.extractTransaction(maxFeeRate?)` forward the value.

The entire API is in **sat/vB** — the same unit as rust-bitcoin's
`FeeRate` — so no conversion happens inside wasm-utxo. Callers that
hold sat/kB thresholds (e.g. wallet-platform's `maxFeeRateSatPerKB`)
must divide by 1000 at the callsite before passing.

Per-coin default thresholds and the `fees` namespace land in a
follow-up change that builds on this plumbing.

Refs: T1-3656
@linear-code

linear-code Bot commented Jun 30, 2026

Copy link
Copy Markdown

T1-3656

@OttoAllmendinger OttoAllmendinger marked this pull request as ready for review June 30, 2026 09:22
@OttoAllmendinger OttoAllmendinger requested a review from a team as a code owner June 30, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant