rpc: Remove meaningless bool fallback in FundTransaction #35836

pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2607-rpc-schema-cleanup changing 2 files +60 −65
  1. maflcko commented at 2:49 PM on July 29, 2026: member

    This mostly removes a no-op and meaningless bool fallback in the fundrawtransaction RPC.

    This allows to remove a skip_type_check.

    Also, this makes validating the JSON schema from #34683 more consistent.

  2. DrahtBot renamed this:
    rpc: Remove meaningless bool fallback in FundTransaction
    rpc: Remove meaningless bool fallback in FundTransaction
    on Jul 29, 2026
  3. DrahtBot added the label RPC/REST/ZMQ on Jul 29, 2026
  4. DrahtBot commented at 2:49 PM on July 29, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35836.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #35433 (wallet: deprecate replaceable argument from transaction (and psbt) creation (and modification) RPCs by rkrux)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

    LLM Linter (✨ experimental)

    Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

    • RPCTypeCheckObj(options, {...}, true, true) in src/wallet/rpc/spend.cpp

    <sup>2026-07-30 07:01:32</sup>

  5. wallet: Remove meaningless bool fallback in FundTransaction
    The fallback was added in commit
    af4fe7fd126eff2dd1942276ea91c8ab9dd717c6, more than a decade ago.
    
    However, it is irrelevant, given that watch-only wallet is not a concept
    anymore after commit 1337c72198a7d32935431d64e9e58c12f9003abc.
    
    So remove the code.
    
    Can be reviewed with the --ignore-all-space option.
    fa7fe798c6
  6. maflcko force-pushed on Jul 30, 2026
  7. maflcko commented at 7:05 AM on July 30, 2026: member

    Rendered diff:

    diff --git a/getopenrpcinfo.full.json b/getopenrpcinfo.full.json
    index 301098f..f922401 100644
    --- a/getopenrpcinfo.full.json
    +++ b/getopenrpcinfo.full.json
    @@ -2914,33 +2914,197 @@
             {
                 "name": "fundrawtransaction",
                 "description": "If the transaction has no inputs, they will be automatically selected to meet its out value.\nIt will add at most one change output to the outputs.\nNo existing outputs will be modified unless \"subtractFeeFromOutputs\" is specified.\nNote that inputs which were signed may need to be resigned after completion since in/outputs have been added.\nThe inputs added will not be signed, use signrawtransactionwithkey\nor signrawtransactionwithwallet for that.\nAll existing inputs must either have their previous output transaction be in the wallet\nor be in the UTXO set. Solving data must be provided for non-wallet inputs.\nNote that all inputs selected must be of standard form and P2SH scripts must be\nin the wallet using importdescriptors (to calculate fees).\nYou can see whether this is the case by checking the \"solvable\" field in the listunspent output.\nNote that if specifying an exact fee rate, the resulting transaction may have a higher fee rate\nif the transaction has unconfirmed inputs. This is because the wallet will attempt to make the\nentire package have the given fee rate, not the resulting transaction.",
                 "params": [
                     {
                         "name": "hexstring",
                         "required": true,
                         "schema": {
                             "type": "string",
                             "pattern": "^[0-9a-fA-F]+$"
                         },
                         "description": "The hex string of the raw transaction"
                     },
                     {
                         "name": "options",
                         "required": false,
    -                    "schema": {}
    +                    "schema": {
    +                        "type": "object",
    +                        "properties": {
    +                            "add_inputs": {
    +                                "type": "boolean",
    +                                "default": true,
    +                                "description": "For a transaction with existing inputs, automatically include more if they are not enough."
    +                            },
    +                            "include_unsafe": {
    +                                "type": "boolean",
    +                                "default": false,
    +                                "description": "Include inputs that are not safe to spend (unconfirmed transactions from outside keys and unconfirmed replacement transactions).\nWarning: the resulting transaction may become invalid if one of the unsafe inputs disappears.\nIf that happens, you will need to fund the transaction with different inputs and republish it."
    +                            },
    +                            "minconf": {
    +                                "type": "number",
    +                                "default": 0,
    +                                "description": "If add_inputs is specified, require inputs with at least this many confirmations."
    +                            },
    +                            "maxconf": {
    +                                "type": "number",
    +                                "description": "If add_inputs is specified, require inputs with at most this many confirmations."
    +                            },
    +                            "changeAddress": {
    +                                "type": "string",
    +                                "x-bitcoin-default-hint": "automatic",
    +                                "description": "The bitcoin address to receive the change"
    +                            },
    +                            "changePosition": {
    +                                "type": "number",
    +                                "x-bitcoin-default-hint": "random",
    +                                "description": "The index of the change output"
    +                            },
    +                            "change_type": {
    +                                "type": "string",
    +                                "x-bitcoin-default-hint": "set by -changetype",
    +                                "description": "The output type to use. Only valid if changeAddress is not specified. Options are \"legacy\", \"p2sh-segwit\", \"bech32\", \"bech32m\"."
    +                            },
    +                            "includeWatching": {
    +                                "type": "boolean",
    +                                "default": false,
    +                                "description": "(DEPRECATED) No longer used"
    +                            },
    +                            "lockUnspents": {
    +                                "type": "boolean",
    +                                "default": false,
    +                                "description": "Lock selected unspent outputs"
    +                            },
    +                            "fee_rate": {
    +                                "oneOf": [
    +                                    {
    +                                        "type": "number"
    +                                    },
    +                                    {
    +                                        "type": "string"
    +                                    }
    +                                ],
    +                                "x-bitcoin-default-hint": "not set, fall back to wallet fee estimation",
    +                                "description": "Specify a fee rate in sat/vB."
    +                            },
    +                            "feeRate": {
    +                                "oneOf": [
    +                                    {
    +                                        "type": "number"
    +                                    },
    +                                    {
    +                                        "type": "string"
    +                                    }
    +                                ],
    +                                "x-bitcoin-default-hint": "not set, fall back to wallet fee estimation",
    +                                "description": "Specify a fee rate in BTC/kvB."
    +                            },
    +                            "subtractFeeFromOutputs": {
    +                                "type": "array",
    +                                "items": {
    +                                    "type": "number"
    +                                },
    +                                "default": [],
    +                                "description": "The integers.\nThe fee will be equally deducted from the amount of each specified output.\nThose recipients will receive less bitcoins than you enter in their corresponding amount field.\nIf no outputs are specified here, the sender pays the fee."
    +                            },
    +                            "input_weights": {
    +                                "type": "array",
    +                                "items": {
    +                                    "type": "object",
    +                                    "properties": {
    +                                        "txid": {
    +                                            "type": "string",
    +                                            "pattern": "^[0-9a-fA-F]+$",
    +                                            "description": "The transaction id"
    +                                        },
    +                                        "vout": {
    +                                            "type": "number",
    +                                            "description": "The output index"
    +                                        },
    +                                        "weight": {
    +                                            "type": "number",
    +                                            "description": "The maximum weight for this input, including the weight of the outpoint and sequence number. Note that serialized signature sizes are not guaranteed to be consistent, so the maximum DER signatures size of 73 bytes should be used when considering ECDSA signatures.Remember to convert serialized sizes to weight units when necessary."
    +                                        }
    +                                    },
    +                                    "additionalProperties": false,
    +                                    "required": [
    +                                        "txid",
    +                                        "vout",
    +                                        "weight"
    +                                    ]
    +                                },
    +                                "description": "Inputs and their corresponding weights"
    +                            },
    +                            "max_tx_weight": {
    +                                "type": "number",
    +                                "default": 400000,
    +                                "description": "The maximum acceptable transaction weight.\nTransaction building will fail if this can not be satisfied."
    +                            },
    +                            "conf_target": {
    +                                "type": "number",
    +                                "x-bitcoin-default-hint": "wallet -txconfirmtarget",
    +                                "description": "Confirmation target in blocks",
    +                                "x-bitcoin-also-positional": true
    +                            },
    +                            "estimate_mode": {
    +                                "type": "string",
    +                                "default": "unset",
    +                                "description": "The fee estimate mode, must be one of (case insensitive):\nunset, economical, conservative \nunset means no mode set (economical mode is used if the transaction is replaceable;\notherwise, conservative mode is used). \neconomical estimates use a shorter time horizon, making them more\nresponsive to short-term drops in the prevailing fee market. This mode\npotentially returns a lower fee rate estimate.\nconservative estimates use a longer time horizon, making them\nless responsive to short-term drops in the prevailing fee market. This mode\npotentially returns a higher fee rate estimate.\n",
    +                                "x-bitcoin-also-positional": true
    +                            },
    +                            "replaceable": {
    +                                "type": "boolean",
    +                                "x-bitcoin-default-hint": "wallet default",
    +                                "description": "Marks this transaction as BIP125-replaceable.\nAllows this transaction to be replaced by a transaction with higher fees"
    +                            },
    +                            "solving_data": {
    +                                "type": "object",
    +                                "properties": {
    +                                    "pubkeys": {
    +                                        "type": "array",
    +                                        "items": {
    +                                            "type": "string",
    +                                            "pattern": "^[0-9a-fA-F]+$"
    +                                        },
    +                                        "default": [],
    +                                        "description": "Public keys involved in this transaction."
    +                                    },
    +                                    "scripts": {
    +                                        "type": "array",
    +                                        "items": {
    +                                            "type": "string",
    +                                            "pattern": "^[0-9a-fA-F]+$"
    +                                        },
    +                                        "default": [],
    +                                        "description": "Scripts involved in this transaction."
    +                                    },
    +                                    "descriptors": {
    +                                        "type": "array",
    +                                        "items": {
    +                                            "type": "string"
    +                                        },
    +                                        "default": [],
    +                                        "description": "Descriptors that provide solving data for this transaction."
    +                                    }
    +                                },
    +                                "additionalProperties": false,
    +                                "description": "Keys and scripts needed for producing a final transaction with a dummy signature.\nUsed for fee estimation during coin selection."
    +                            }
    +                        },
    +                        "additionalProperties": false
    +                    }
                     },
                     {
                         "name": "iswitness",
                         "required": false,
                         "schema": {
                             "type": "boolean",
                             "x-bitcoin-default-hint": "depends on heuristic tests"
                         },
                         "description": "Whether the transaction hex is a serialized witness transaction.\nIf iswitness is not present, heuristic tests will be used in decoding.\nIf true, only witness deserialization will be tried.\nIf false, only non-witness deserialization will be tried.\nThis boolean should reflect whether the transaction has inputs\n(e.g. fully valid, or on-chain transactions), if known by the caller."
                     }
                 ],
                 "result": {
                     "name": "result",
                     "schema": {
                         "type": "object",
                         "properties": {
    
  8. polespinasa commented at 11:06 AM on July 30, 2026: member

    ~To get more context, in the past fundrawtransaction only took two arguments, rawtx and includeWatching?~ Oh wait sorry, didn't see the two commits mentioned in the commit message :)

    The question is, are we breaking backwards compatibility be removing that type check and disabling using a bool as second argument? Even if it is irrelevant, could be that someone still uses it?

  9. maflcko commented at 12:22 PM on July 30, 2026: member

    The question is, are we breaking backwards compatibility be removing that type check and disabling using a bool as second argument? Even if it is irrelevant, could be that someone still uses it?

    This is not removing a type check, it is removing a skipped type check. That is, it is adding a type check (both in the server and the openrpc spec). Yes, in theory someone could be using this dummy bool. However, adding the type check here is useful, because:

    • Retaining backwards compat with more than 10-year old clients seems purely theoretical. There were other breaking RPC changes on shorter notice in the meantime. If someone really forgot to update this over the last 10 years, I don't see a downside of notifying them.
    • The compat only works for positional args, which seems another small reason to drop it.
    • As explained in the pull description, the compat is now completely meaningless and a no-op anyway.
    • Keeping the compat means that openrpc spec users do not get any type checks at all here.

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-07-31 20:50 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me