#35317 wallet: fix ignored subtract_fee_from_outputs option
https://github.com/bitcoin/bitcoin/pull/35317 · · +57/-13 in 3 files, 2 commits · labels: Wallet
Goal
- Prevent wallet funding RPCs from silently ignoring the snake_case subtract_fee_from_outputs option
- Ensure fees are subtracted from outputs as requested instead of unexpectedly paid from inputs
This PR updates `fundrawtransaction` and `walletcreatefundedpsbt` to accept `subtract_fee_from_outputs` in addition to `subtractFeeFromOutputs` when building transaction recipients. Previously, the option was accepted during option parsing but silently ignored during recipient construction. It also adds snake_case funding options to RPC help documentation and client conversion tables.
Problem: Callers passing the snake_case option `subtract_fee_from_outputs` to wallet funding RPCs have their option silently ignored, causing transaction recipients to receive full amounts and fees to be paid from wallet inputs instead.
Category: Wallet (#48 of 84)
P3 · bug fix
- P3 because it fixes a silently ignored funding parameter in wallet RPCs
- Impact is low because callers using the documented camelCase parameter work as expected
Fixes a bug where passing snake_case subtract_fee_from_outputs is accepted by parameter validation but ignored when calculating recipient amounts. The impact is relatively low because callers using the documented camelCase parameter work as expected.
Membership: Modifies wallet RPC funding logic and recipient construction in src/wallet/rpc/spend.cpp.
Factors: security/stability 0, bug 1, performance 0, user value 1, leverage 0
Reviewability: Stale: Author silent 85d
- Author has been inactive for 85 days after asking whether to close the PR
The author has been inactive for 85 days after asking if the PR should be closed in favor of an issue.
Author status: silent since 2026-06-24 after asking whether to close the PR
Open concerns:
- Reviewers prefer a unified approach to standardize all RPC argument handling to snake_case with deprecation of camelCase, rather than piecemeal aliases
- Reviewers suggested closing this PR in favor of a tracking issue or comprehensive overhaul
Resolved concerns:
- RPC help text was updated to include snake_case option aliases and client conversion parameters were added
Agreement: Mild
- Reviewers prefer a codebase-wide transition to snake_case RPC options over piecemeal fixes
- Suggested standardizing all RPC argument handling and deprecating camelCase (achow101)
- Suggested closing the PR in favor of an issue (sedited)
- Pointed to existing tracking work and recommended a linter approach (maflcko)
Reviewers favor a unified snake_case transition across all RPCs instead of piecemeal fixes; reviewers suggested closing in favor of an issue.
There is no objection to fixing the bug itself, but reviewers prefer a comprehensive overhaul of RPC option naming across the codebase rather than adding aliases to individual wallet RPCs.
- achow101 suggested that argument handling across all RPCs should be unified to snake_case with deprecation of camelCase args rather than piecemeal changes
- sedited agreed that closing the PR in favor of an issue would be preferred
- maflcko pointed out existing tracking work on naming consistency and suggested a linter approach
Review verdicts (DrahtBot): 0
Files
31 lines under test/bench/ci.
- src/wallet/rpc/spend.cpp +20/-13
- test/functional/wallet_fundrawtransaction.py +31/-0
- src/rpc/client.cpp +6/-0
Card
This PR updates fundrawtransaction and walletcreatefundedpsbt so that the snake_case subtract_fee_from_outputs option is honored instead of silently ignored when constructing recipients. It also exposes snake_case aliases in RPC help and adds them to client conversion tables. The bug causes unintended fee deduction behavior when callers supply snake_case options, but reviewers generally prefer a unified naming transition across all RPCs rather than one-off alias additions. Reviewers suggested closing the PR in favor of an issue, and the author has been inactive for 85 days.