Skip to content

Conversation

@jb55
Copy link
Contributor

@jb55 jb55 commented Jul 13, 2019

Right now it's a bit annoying to deal with watchonly wallets, many rpc commands have an include_watchonly argument that needs to be explicitly set.

Wallets created with createwallet can have a disable_private_keys parameter, for those wallets we already know that they are watchonly, so there's no reason to have to explicitly ask for it for every command. Instead we check this wallet flag when the include_watchonly parameter isn't set.

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

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

Would have to update the documentation as well for the "smart" default value.

@jb55 jb55 force-pushed the 20190713-watchonly-defaults branch from 5bd7c0c to 2370175 Compare July 13, 2019 16:32
@achow101
Copy link
Member

Concept ACK. I think having include_watchonly default to true for actual watchonly wallets is super useful.

@jb55 jb55 force-pushed the 20190713-watchonly-defaults branch from 2370175 to d60e77c Compare July 13, 2019 16:45
@jb55
Copy link
Contributor Author

jb55 commented Jul 13, 2019

@MarcoFalke I'm a bit new, which docs specifically would need to be updated?

@maflcko
Copy link
Member

maflcko commented Jul 13, 2019

@MarcoFalke I'm a bit new, which docs specifically would need to be updated?

-                    {"include_watchonly", RPCArg::Type::BOOL, /* default */ "false", "Whether to include watch-only addresses in balance calculation and details[]"},
+                    {"include_watchonly", RPCArg::Type::BOOL, /* default */ ">>>>>>>>>>> update here<<<<<<<<", "Whether to include watch-only addresses in balance calculation and details[]"},

Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

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

Concept ACK. Will test when help docs are updated. Seems this change would merit test coverage?

@jb55 jb55 force-pushed the 20190713-watchonly-defaults branch 2 times, most recently from 9a33c13 to 3c145c3 Compare July 13, 2019 19:06
@jb55
Copy link
Contributor Author

jb55 commented Jul 13, 2019

@MarcoFalke I wasn't quite sure what to do for documenting the smart default, let me know if that looks ok

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 14, 2019

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #16397 (Clarify includeWatching for fundrawtransaction by stevenroose)
  • #16185 (gettransaction: add an argument to decode the transaction by darosior)
  • #15729 (rpc: Raise error in getbalance if minconf is not zero by promag)
  • #14707 ([RPC] Include coinbase transactions in receivedby RPCs by andrewtoth)

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.

@jb55 jb55 force-pushed the 20190713-watchonly-defaults branch from 3c145c3 to cc0d834 Compare July 14, 2019 17:21
Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

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

Concept ACK

Seems this change would merit test coverage?

Agree with @jonatack. Also add a minor release note?

@laanwj
Copy link
Member

laanwj commented Jul 15, 2019

Concept ACK, this definitely seems like the only sensible default to have in that case.

@instagibbs
Copy link
Member

concept ACK, needs tests(as others have said)

@jb55
Copy link
Contributor Author

jb55 commented Jul 16, 2019

One thing I missed was rpcs with the includeWatching option such as fundrawtransaction and walletcreatefundedpsbt. I think it makes sense to add the default on those as well.

@jonasschnelli
Copy link
Contributor

Concept ACK

@jb55 jb55 force-pushed the 20190713-watchonly-defaults branch from cc0d834 to efbe2c9 Compare July 18, 2019 20:37
jb55 added 2 commits July 18, 2019 13:38
The logic before would only include watchonly addresses if it was
explicitly set in the rpc argument.

This changes the logic like so:

If the include_watchonly argument is missing, check the
WALLET_FLAG_DISABLE_PRIVATE_KEYS flag to determine if we're working
with a watchonly wallet. If so, default include_watchonly to true.

If the include_watchonly argument is explicit set to false, we still
disable them from the listing. Although this would always return
nothing, it might be still useful in situations where you want to
explicitly filter out watchonly addresses regardless of what wallet
you are dealing with.

Signed-off-by: William Casarin <[email protected]>
@jb55 jb55 force-pushed the 20190713-watchonly-defaults branch 2 times, most recently from 4caca1d to c7cbf29 Compare July 18, 2019 20:41
@jb55
Copy link
Contributor Author

jb55 commented Jul 18, 2019

Latest updates:

  • Added the new defaulting logic to walletcreatefundedpsbt and fundrawtransaction's includeWatching option.
  • Fixed @promag's nits
  • Added release notes
  • Added functional tests for the new defaults

This is the first time I've done the last two things, so let me know if I did anything wrong.

Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

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

ACK 72eaab0 - I've looked over the changes, they make sense to me. Compiled and ran the tests etc.

Thanks to @kallewoof and @ajtowns (he said he sanity checked on his lunch break) for following up my review prod.

I know there are some nits here, however this has ACKs, and has been sitting for a while, so I'm going to merge it. The nits can be scooped up by someone in either a follow up PR, or a related change.

@fanquake fanquake merged commit 72eaab0 into bitcoin:master Aug 16, 2019
fanquake added a commit that referenced this pull request Aug 16, 2019
…nly wallets

72eaab0 tests: functional watch-only wallet tests (William Casarin)
72ffbdc doc: add release note for include_watchonly default changes (William Casarin)
003a3c7 rpcwallet: document include_watchonly default for watchonly wallets (William Casarin)
a50d9e6 rpcwallet: default include_watchonly to true for watchonly wallets (William Casarin)

Pull request description:

  Right now it's a bit annoying to deal with watchonly wallets, many rpc commands have an `include_watchonly` argument that needs to be explicitly set.

  Wallets created with `createwallet` can have a `disable_private_keys` parameter, for those wallets we already know that they are watchonly, so there's no reason to have to explicitly ask for it for every command. Instead we check this wallet flag when the `include_watchonly` parameter isn't set.

ACKs for top commit:
  achow101:
    Code review ACK 72eaab0
  Sjors:
    ACK 72eaab0
  promag:
    ACK 72eaab0, code review only, didn't look closely to the test.
  kallewoof:
    ACK 72eaab0
  fanquake:
    ACK 72eaab0 - I've looked over the changes, they make sense to me. Compiled and ran the tests etc.

Tree-SHA512: d3646b55e97f386594d7efc994f0712f3888475c6a5dc7f131ac9f8c49bf5d4677182b88f42b34152abe1ad101ecadd152b4c20e9d3c1267190db36f77ab8bd7
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 17, 2019
… watchonly wallets

72eaab0 tests: functional watch-only wallet tests (William Casarin)
72ffbdc doc: add release note for include_watchonly default changes (William Casarin)
003a3c7 rpcwallet: document include_watchonly default for watchonly wallets (William Casarin)
a50d9e6 rpcwallet: default include_watchonly to true for watchonly wallets (William Casarin)

Pull request description:

  Right now it's a bit annoying to deal with watchonly wallets, many rpc commands have an `include_watchonly` argument that needs to be explicitly set.

  Wallets created with `createwallet` can have a `disable_private_keys` parameter, for those wallets we already know that they are watchonly, so there's no reason to have to explicitly ask for it for every command. Instead we check this wallet flag when the `include_watchonly` parameter isn't set.

ACKs for top commit:
  achow101:
    Code review ACK 72eaab0
  Sjors:
    ACK 72eaab0
  promag:
    ACK 72eaab0, code review only, didn't look closely to the test.
  kallewoof:
    ACK 72eaab0
  fanquake:
    ACK 72eaab0 - I've looked over the changes, they make sense to me. Compiled and ran the tests etc.

Tree-SHA512: d3646b55e97f386594d7efc994f0712f3888475c6a5dc7f131ac9f8c49bf5d4677182b88f42b34152abe1ad101ecadd152b4c20e9d3c1267190db36f77ab8bd7
@jb55 jb55 deleted the 20190713-watchonly-defaults branch May 21, 2020 17:24
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Aug 7, 2020
… watchonly wallets

Summary:
The logic before would only include watchonly addresses if it was
explicitly set in the rpc argument.

This changes the logic like so:

If the include_watchonly argument is missing, check the
WALLET_FLAG_DISABLE_PRIVATE_KEYS flag to determine if we're working
with a watchonly wallet. If so, default include_watchonly to true.

If the include_watchonly argument is explicit set to false, we still
disable them from the listing. Although this would always return
nothing, it might be still useful in situations where you want to
explicitly filter out watchonly addresses regardless of what wallet
you are dealing with.

Signed-off-by: William Casarin <[email protected]>

bitcoin/bitcoin@a50d9e6

---

Partial backport of Core [[bitcoin/bitcoin#16383 | PR16383]]

Test Plan:
  ninja check check-functional

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D7121
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Aug 7, 2020
…r watchonly wallets

Summary:
Signed-off-by: William Casarin <[email protected]>

bitcoin/bitcoin@003a3c7

---

Depends on D7121

Partial backport of Core [[bitcoin/bitcoin#16383 | PR16383]]

Test Plan:
  ninja

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D7122
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Aug 7, 2020
Summary:
These test the new watch-only defaults for rpcs with include_watchonly
and includeWatching options.

Signed-off-by: William Casarin <[email protected]>

bitcoin/bitcoin@72eaab0

doc: add release note for include_watchonly default changes

Signed-off-by: William Casarin <[email protected]>

bitcoin/bitcoin@72ffbdc

---

Depends on D7122

Concludes backport of Core [[bitcoin/bitcoin#16383 | PR16383]]

Test Plan:
  ninja check check-functional

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D7123
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
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.