docs: Update the explainer text for the listunspent RPC #22525

pull Fonta1n3 wants to merge 1 commits into bitcoin:master from Fonta1n3:master changing 1 files +1 −1
  1. Fonta1n3 commented at 6:10 AM on July 22, 2021: none

    Users may find it confusing to see that their utxo is labelled as spendable when they know for certain their wallet does not hold private keys.

    This is a minor documentation fix for bitcoin-cli listunspent to clarify that native descriptor wallets always consider utxos to be spendable.

    Fixes #22518.

  2. fanquake added the label Docs on Jul 22, 2021
  3. Fonta1n3 marked this as a draft on Jul 22, 2021
  4. Fonta1n3 marked this as ready for review on Jul 22, 2021
  5. Fonta1n3 renamed this:
    Update the explainer text for `bitcoin-cli listunspent`
    docs: Update the explainer text for `bitcoin-cli listunspent`
    on Jul 22, 2021
  6. in src/wallet/rpcwallet.cpp:2885 in eab0c131bc outdated
    2881 | @@ -2882,7 +2882,7 @@ static RPCHelpMan listunspent()
    2882 |                              {RPCResult::Type::NUM, "confirmations", "The number of confirmations"},
    2883 |                              {RPCResult::Type::STR_HEX, "redeemScript", "The redeemScript if scriptPubKey is P2SH"},
    2884 |                              {RPCResult::Type::STR, "witnessScript", "witnessScript if the scriptPubKey is P2WSH or P2SH-P2WSH"},
    2885 | -                            {RPCResult::Type::BOOL, "spendable", "Whether we have the private keys to spend this output"},
    2886 | +                            {RPCResult::Type::BOOL, "spendable", "Whether we have the private keys to spend this output. Native descriptor wallets will always return true irregardless of whether the wallet holds private keys for the output."},
    


    unknown commented at 6:26 AM on July 22, 2021:
                                {RPCResult::Type::BOOL, "spendable", "Whether we have the private keys to spend this output. Native descriptor wallets will always return true regardless of the wallet having private keys for the output."},
    

    Replaced 'irregardless' with 'regardless' because it looks weird and people have different opinions about its grammar: https://english.stackexchange.com/questions/1259/irregardless-vs-irrespective

    Removed 'whether' from 'regardless of whether' and people have different opinions about it: https://english.stackexchange.com/questions/107183/is-regardless-of-whether-or-not-proper-grammar

  7. ghost commented at 6:27 AM on July 22, 2021: none
  8. Fonta1n3 force-pushed on Jul 22, 2021
  9. Fonta1n3 commented at 10:39 AM on July 22, 2021: none
  10. in src/wallet/rpcwallet.cpp:2885 in 7ac39cb8aa outdated
    2881 | @@ -2882,7 +2882,7 @@ static RPCHelpMan listunspent()
    2882 |                              {RPCResult::Type::NUM, "confirmations", "The number of confirmations"},
    2883 |                              {RPCResult::Type::STR_HEX, "redeemScript", "The redeemScript if scriptPubKey is P2SH"},
    2884 |                              {RPCResult::Type::STR, "witnessScript", "witnessScript if the scriptPubKey is P2WSH or P2SH-P2WSH"},
    2885 | -                            {RPCResult::Type::BOOL, "spendable", "Whether we have the private keys to spend this output"},
    2886 | +                            {RPCResult::Type::BOOL, "spendable", "Whether we have the private keys to spend this output. Native descriptor wallets will always return true irregardless of whether the wallet holds private keys for the output"},
    


    jonatack commented at 4:16 PM on July 22, 2021:

    Echoing @prayank23's very good feedback, which is simultaneously more correct and shorter.

                                {RPCResult::Type::BOOL, "spendable", "Whether we have the private keys to spend this output. Native descriptor wallets will always return true regardless of the wallet having private keys for the output."},
    

    nit, as the addition is a full sentence, it makes sense to use sentence punctuation here.

  11. Fonta1n3 commented at 12:52 AM on July 23, 2021: none

    Ah sorry I misread that. Will make the change.

  12. docs: update the help command for listunspent
    Native descriptor wallets always consider outputs to be spendable. This should be made clear as it is an important distinction.
    
    Update src/wallet/rpcwallet.cpp
    
    Better grammar.
    
    Co-authored-by: Jon Atack <jon@atack.com>
    332192cea5
  13. Fonta1n3 force-pushed on Jul 23, 2021
  14. jarolrod commented at 4:57 AM on July 23, 2021: member

    ACK 332192cea599666fd9f1038bd53163477ad49b8c

    Looks good to me 🥃 This change is conceptually correct. This is the current behavior.

  15. MarcoFalke renamed this:
    docs: Update the explainer text for `bitcoin-cli listunspent`
    docs: Update the explainer text for the listunspent RPC
    on Jul 23, 2021
  16. MarcoFalke added the label RPC/REST/ZMQ on Jul 23, 2021
  17. flack commented at 2:04 PM on July 28, 2021: contributor

    maybe as an alternative, this could be written something like this:

    Whether we have the private keys to spend this output (in legacy wallets only, native descriptor wallets always return true).

    Because it seems like this field only does something useful for legacy wallets (and will probably be deprecated once they are)

  18. tryphe changes_requested
  19. tryphe commented at 5:21 AM on July 30, 2021: contributor

    Thanks for your first PR!

    The message should have a line break after each chunk of 80(?) characters. See this one for example.

    Small nit, I would prefer the added message to be: Native descriptor wallets will always return true. versus: Native descriptor wallets will always return true regardless of the wallet having private keys for the output.

    The first one seems just as informative and more terse, since by definition, descriptor wallets don't have the keys. But maybe it's just personal preference.

    Feel free to mark my comments as resolved as you wish.

  20. tryphe commented at 5:29 AM on July 30, 2021: contributor

    Hmm, that's weird. Some messages truncate at 80 or 100, but some go beyond 100. Perhaps a change was made specifically to this line and the width was ignored.

    Maybe another reviewer knows what the correct width is? Does it not matter now?

  21. Fonta1n3 commented at 1:51 AM on August 1, 2021: none

    Thanks for your first PR!

    The message should have a line break after each chunk of 80(?) characters. See this one for example.

    Small nit, I would prefer the added message to be: Native descriptor wallets will always return true. versus: Native descriptor wallets will always return true regardless of the wallet having private keys for the output.

    The first one seems just as informative and more terse, since by definition, descriptor wallets don't have the keys. But maybe it's just personal preference.

    Feel free to mark my comments as resolved as you wish.

    I agree its neater and more terse but it could be misinterpreted that all native descriptor wallets hold private keys if the help text only states Native descriptor wallets will always return true.

  22. fanquake requested review from achow101 on Aug 12, 2021
  23. achow101 commented at 5:19 PM on August 12, 2021: member

    I feel like it would be better to explain what the consequences of something being spendable is rather than when the wallet would mark an UTXO as spendable. Spendable really means that the wallet will consider the UTXO for spending who performing coin selection and include_watchonly is false. Trying to then describe describe the actual behavior of when something is spendable I think is a futile task as it gets into the craziness of ismine. There's more to it than just private keys, scripts are also needed, and only certain scripts.

    Even in legacy wallets, it is possible to create a case where you should be able to spend a UTXO because private keys are available, but the UTXO is marked as not spendable.

  24. DrahtBot commented at 4:37 AM on August 26, 2021: member

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

    • #22798 (doc: Fix RPC result documentation by MarcoFalke)

    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.

  25. DrahtBot commented at 8:31 AM on September 23, 2021: member

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

  26. DrahtBot added the label Needs rebase on Sep 23, 2021
  27. Fonta1n3 commented at 11:01 AM on September 23, 2021: none

    I feel like it would be better to explain what the consequences of something being spendable is rather than when the wallet would mark an UTXO as spendable. Spendable really means that the wallet will consider the UTXO for spending who performing coin selection and include_watchonly is false. Trying to then describe describe the actual behavior of when something is spendable I think is a futile task as it gets into the craziness of ismine. There's more to it than just private keys, scripts are also needed, and only certain scripts.

    Even in legacy wallets, it is possible to create a case where you should be able to spend a UTXO because private keys are available, but the UTXO is marked

    I agree the more accurate the text the better. My PR certainly makes an improvement on the existing text which is down right misleading. I do not have the understanding of the underlying functionality to add anything more useful here, if you have a suggestion I am all ears.

  28. DrahtBot commented at 12:28 PM on December 22, 2021: member

    <!--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.
  29. MarcoFalke closed this on Apr 29, 2022

  30. MarcoFalke commented at 2:22 PM on April 29, 2022: member

    Closing for now. Let us know if it should be reopened.

  31. DrahtBot locked this on Apr 29, 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