Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from

Conversation

Fonta1n3
Copy link

@Fonta1n3 Fonta1n3 commented Jul 22, 2021

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.

@fanquake fanquake added the Docs label Jul 22, 2021
@Fonta1n3 Fonta1n3 marked this pull request as draft July 22, 2021 06:12
@Fonta1n3 Fonta1n3 marked this pull request as ready for review July 22, 2021 06:16
@Fonta1n3 Fonta1n3 changed the title Update the explainer text for bitcoin-cli listunspent docs: Update the explainer text for bitcoin-cli listunspent Jul 22, 2021
@@ -2882,7 +2882,7 @@ static RPCHelpMan listunspent()
{RPCResult::Type::NUM, "confirmations", "The number of confirmations"},
{RPCResult::Type::STR_HEX, "redeemScript", "The redeemScript if scriptPubKey is P2SH"},
{RPCResult::Type::STR, "witnessScript", "witnessScript if the scriptPubKey is P2WSH or P2SH-P2WSH"},
{RPCResult::Type::BOOL, "spendable", "Whether we have the private keys to spend this output"},
{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."},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{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."},
{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

@ghost
Copy link

ghost commented Jul 22, 2021

@Fonta1n3
Copy link
Author

src/wallet/rpcwallet.cpp Outdated Show resolved Hide resolved
@Fonta1n3
Copy link
Author

Ah sorry I misread that. Will make the change.

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>
Copy link
Member

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 332192c

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

@maflcko maflcko changed the title docs: Update the explainer text for bitcoin-cli listunspent docs: Update the explainer text for the listunspent RPC Jul 23, 2021
@flack
Copy link
Contributor

flack commented Jul 28, 2021

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)

Copy link
Contributor

@tryphe tryphe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@tryphe
Copy link
Contributor

tryphe commented Jul 30, 2021

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?

@Fonta1n3
Copy link
Author

Fonta1n3 commented Aug 1, 2021

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.

@achow101
Copy link
Member

achow101 commented Aug 12, 2021

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.

@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 26, 2021

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

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.

@DrahtBot
Copy link
Contributor

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

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

@Fonta1n3
Copy link
Author

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.

@DrahtBot
Copy link
Contributor

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.

@maflcko maflcko closed this Apr 29, 2022
@maflcko
Copy link
Member

maflcko commented Apr 29, 2022

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

@bitcoin bitcoin locked and limited conversation to collaborators Apr 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0.21.1 native descriptor wallet showing incorrect value for spendable
9 participants