rpc: allow specifying min chain depth for inputs in fund calls #22049

pull champo wants to merge 5 commits into bitcoin:master from muun:psbt_coin_control changing 3 files +154 −0
  1. champo commented at 5:53 PM on May 24, 2021: contributor

    Enables users to craft BIP-125 replacements with changes to the output list, ensuring that if additional funds are inputs they will be added.

  2. rpc: allow specifying min chain depth for inputs in fund calls
    Enables users to craft BIP-125 replacements with changes to the output
    list, ensuring that if additional funds are needed they will be added.
    6086c58d27
  3. DrahtBot added the label RPC/REST/ZMQ on May 24, 2021
  4. DrahtBot added the label Wallet on May 24, 2021
  5. in test/functional/rpc_fundrawtransaction.py:981 in 6086c58d27 outdated
     976 | +        unconfirmedTxid = self.nodes[0].sendtoaddress(unconfirmedAddress, 1)
     977 | +
     978 | +        utxo1 = self.nodes[0].listunspent(0, 1, [unconfirmedAddress])[0]
     979 | +        assert unconfirmedTxid == utxo1['txid']
     980 | +
     981 | +        self.log.info("Crafting PSBT using an unconfirmed input")
    


    achow101 commented at 8:04 PM on May 24, 2021:

    In 6086c58d27146d500b7ff8de89a5279a6f88457d "rpc: allow specifying min chain depth for inputs in fund calls"

            self.log.info("Crafting tx using an unconfirmed input")
    

    Here and elsewhere in this file too.

  6. in src/wallet/rpcwallet.cpp:3227 in 6086c58d27 outdated
    3223 | @@ -3215,6 +3224,7 @@ static RPCHelpMan fundrawtransaction()
    3224 |                              {"include_unsafe", RPCArg::Type::BOOL, RPCArg::Default{false}, "Include inputs that are not safe to spend (unconfirmed transactions from outside keys and unconfirmed replacement transactions).\n"
    3225 |                                                            "Warning: the resulting transaction may become invalid if one of the unsafe inputs disappears.\n"
    3226 |                                                            "If that happens, you will need to fund the transaction with different inputs and republish it."},
    3227 | +                            {"inputs_min_depth", RPCArg::Type::NUM, RPCArg::Default{0}, "If add_inputs is specified, require inputs with at least this chain depth."},
    


    promag commented at 8:06 PM on May 24, 2021:

    IMO should be minconf, see listunspent RPC.

  7. achow101 commented at 8:06 PM on May 24, 2021: member

    Seems reasonable, although the use case for this is not immediately obvious to me.

    Perhaps it would also be useful to add inputs_max_depth too?

  8. promag commented at 8:07 PM on May 24, 2021: member

    Concept ACK.

  9. champo commented at 8:14 PM on May 24, 2021: contributor

    Seems reasonable, although the use case for this is not immediately obvious to me.

    The use case is for applications that are using RBF for something else than bumping fee (as implemented by bumpfee RPC). RBF requires new inputs added to a replacement to be confirmed. The functional tests are modeled after one of the use cases: increasing the value of an output beyond the current funding of the TX.

    Perhaps it would also be useful to add inputs_max_depth too?

    Will do!

  10. test: fix inputs_min_depth test cases after rebase 91c0a3af93
  11. rpc: rename inputs_min_depth to minconfs for consistency with listunspent 87371bf119
  12. DrahtBot commented at 9:53 PM on May 24, 2021: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #22686 (wallet: Use GetSelectionAmount in ApproximateBestSubset by achow101)
    • #17211 (Allow fundrawtransaction and walletcreatefundedpsbt to take external inputs by achow101)

    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.

  13. rpc: add maxconfs parameter in fund calls 290f9dad44
  14. champo commented at 10:13 PM on May 24, 2021: contributor

    Thanks for the quick look guys! I've updated the changset with your feedback. I'm not sure what the ettiquete is here regarding squashing mid-review, so I opted to add new commits. LMK if this is not what you expect.

  15. scripted-diff: drop trailing s from maxconfs and minconfs
    -BEGIN VERIFY SCRIPT-
    sed -i"" -e "s/minconfs/minconf/" ./src/wallet/rpcwallet.cpp ./test/functional/rpc_fundrawtransaction.py ./test/functional/rpc_psbt.py
    sed -i"" -e "s/maxconfs/maxconf/" ./src/wallet/rpcwallet.cpp ./test/functional/rpc_fundrawtransaction.py ./test/functional/rpc_psbt.py
    -END VERIFY SCRIPT-
    7f4c9039f7
  16. in src/wallet/rpcwallet.cpp:4066 in 290f9dad44 outdated
    4062 | @@ -4043,6 +4063,8 @@ static RPCHelpMan send()
    4063 |                      {"include_unsafe", RPCArg::Type::BOOL, RPCArg::Default{false}, "Include inputs that are not safe to spend (unconfirmed transactions from outside keys and unconfirmed replacement transactions).\n"
    4064 |                                                            "Warning: the resulting transaction may become invalid if one of the unsafe inputs disappears.\n"
    4065 |                                                            "If that happens, you will need to fund the transaction with different inputs and republish it."},
    4066 | +                    {"minconfs", RPCArg::Type::NUM, RPCArg::Default{0}, "If add_inputs is specified, require inputs with at least this confirmations."},
    


  17. luke-jr commented at 4:32 AM on June 25, 2021: member

    Duplicate of #14641 ?

  18. DrahtBot commented at 8:26 AM on August 16, 2021: contributor

    <!--cf906140f33d8803c4a75a2196329ecb-->

    🐙 This pull request conflicts with the target branch and needs rebase.

    <sub>Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft".</sub>

  19. DrahtBot added the label Needs rebase on Aug 16, 2021
  20. DrahtBot commented at 12:28 PM on December 22, 2021: contributor

    <!--13523179cfe9479db18ec6c5d236f789-->There hasn't been much activity lately and the patch still needs rebase. What is the status here?

    • Is it still relevant? ➡️ Please solve the conflicts to make it ready for review and to ensure the CI passes.
    • Is it no longer relevant? ➡️ Please close.
    • Did the author lose interest or time to work on this? ➡️ Please close it and mark it 'Up for grabs' with the label, so that it can be picked up in the future.
  21. luke-jr commented at 11:08 PM on February 28, 2022: member
  22. laanwj commented at 10:00 AM on June 22, 2022: member

    Code review ACK. Needs rebase though.

    It looks like some commits can be squashed? E.g. the scripted-diff commit seems to only change code that was introduced in this same PR.

  23. fanquake commented at 9:21 PM on August 15, 2022: member

    @champo would you like to follow up here?

  24. glozow commented at 10:01 AM on September 26, 2022: member

    Closing as this has needed rebase for more than 1 year. Feel free to reopen if you get a chance to work on this again in the future, thanks!

  25. glozow closed this on Sep 26, 2022

  26. bitcoin locked this on Sep 26, 2023

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-04-13 15:14 UTC

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