feat(wasm-utxo): add max_fee_rate param to PSBT extract_transaction#308
Open
OttoAllmendinger wants to merge 1 commit into
Open
feat(wasm-utxo): add max_fee_rate param to PSBT extract_transaction#308OttoAllmendinger wants to merge 1 commit into
OttoAllmendinger wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional
max_fee_rateparameter to the PSBT extract path inwasm-utxoso 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
feesnamespace land in a follow-up that builds on this.Changes
ExtractFeePolicyenum (Default|Unchecked|Limited(FeeRate)) plusextract_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-argextract_*_txmethods delegate withDefault, preserving current behavior.extract_transaction(and the bitcoin/dash/zcash variants) takemax_fee_rate_sat_per_vb: Option<f64>.undefined→Default,Infinity→Unchecked(skip the guard), finite →Limited.BitGoPsbt.extractTransaction(maxFeeRate?)andZcashBitGoPsbt.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 insidewasm-utxo. Callers that hold sat/kB thresholds (e.g. wallet-platform'smaxFeeRateSatPerKB) must divide by 1000 at the callsite before passing.Test plan
cargo build,cargo fmt --check,cargo clippy --all-targetscleanextract*tests pass (delegation is behavior-preserving)test_extract_tx_with_fee_policy_matches_defaultpins thatDefault/Unchecked/Limitedproduce byte-identical output toextract_tx()on a normal-fee PSBTims-utxo/wallet-platformcallsites passmaxFeeRateSatPerKB / 1000(companion PR)Refs: T1-3656