wallet: enforce TRUC child weight for preset inputs #36463

pull jcastros wants to merge 1 commits into bitcoin:master from jcastros:wallet-truc-child-preset changing 3 files +94 −3
  1. jcastros commented at 1:38 AM on October 8, 2026: contributor

    A version 3 transaction that spends an unconfirmed wallet parent can be funded over the 4000 weight-unit child limit when the inputs are preset. Automatic coin selection already clamps that case. Preset inputs that cover the target skip the clamp. With add_inputs=true, a short unconfirmed preset can be topped up with confirmed coins, and those filters do not apply the clamp.

    FetchSelectedInputs records the unconfirmed wallet parent. CreateTransactionInternal rejects the result with "Transaction too large" when the transaction is version 3 and the weight is over the child limit. The standard maximum-weight check is unchanged.

    This edits the same size check as #36393. That change makes the check honor the caller's max weight. This one adds the 4000 weight-unit cap for an unconfirmed wallet parent. If #36393 merges first, this needs a rebase.

    Preset inputs the wallet owns are covered. An output the wallet does not own takes the external path even when the wallet created its parent and knows that parent is unconfirmed. On this build that case funded at 5397 weight units, and testmempoolaccept rejected it. Inputs whose parent the wallet does not know stay out of scope.

    sendall with explicit inputs is left out. sendall does not use CreateTransactionInternal. Its automatic path already lowers the limit to the child size. Its explicit-input path keeps the 40000 weight-unit limit, so an unconfirmed version 3 parent plus confirmed inputs can still be built over the child limit. On this build that case was 6327 weight units, and testmempoolaccept rejected it.

    The same preset gap is on 32.x (2633a1ded5).

    The new wallet_v3_txs.py cases cover four preset spends. An unconfirmed child over the child limit is rejected, and one under the limit funds. A confirmed version 3 preset over 4000 weight units still funds. add_inputs=true is rejected when a short unconfirmed preset is topped up past the child limit. The confirmed case is the one a check based on preset depth would have rejected, because those inputs are recorded with depth 0.

    Tested with the 68 wallet functional tests and rpc_psbt.py, 74 runs including variants. wallet_backwards_compatibility.py, wallet_ancient_migration.py, and wallet_migration.py were skipped because they need previous releases.

  2. wallet: enforce TRUC child weight for preset inputs
    FetchSelectedInputs records when a preset input spends an unconfirmed
    wallet parent. CreateTransactionInternal then rejects such a version 3
    transaction when its weight is over the TRUC child limit.
    
    Preset inputs skip the cap that automatic coin selection already
    applies. The same final check covers add_inputs=true, where a short
    preset can be topped up with confirmed coins without hitting that cap.
    
    External inputs are out of scope. The wallet has no confirmation depth
    for them.
    
    This is the follow-up deferred by #36393.
    b613815420
  3. DrahtBot added the label Wallet on Oct 8, 2026
  4. DrahtBot commented at 1:38 AM on October 8, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--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):

    • test/functional/wallet_v3_txs.py: self.send_tx(self.charlie, [], {address: amount}, 3)
    • test/functional/wallet_v3_txs.py: self.send_tx(self.charlie, [], {self.alice.getnewaddress(): 10}, 3)

    <sup>2026-10-08 01:38:38</sup>

  5. sedited commented at 11:47 AM on October 8, 2026: contributor

    To preserve the time of reviewers, this project requires authors to understand the code they are submitting. Given that the description is entirely LLM generated, I don't think that is the case, so I am closing this again.

  6. sedited closed this on Oct 8, 2026

  7. jcastros deleted the branch on Oct 9, 2026

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-10-11 10:51 UTC

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