-
Notifications
You must be signed in to change notification settings - Fork 266
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
Disallow encryption of watchonly wallets #631
Disallow encryption of watchonly wallets #631
Conversation
Watchonly wallets do not have any private keys to encrypt. It does not make sense to encrypt such wallets, so disable the option to encrypt them. This avoids an assertion that can be hit when encrypting watchonly descriptor wallets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK 4c49541
I couldn't reproduce the crash mentioned on IRC. On my machine (Ubuntu 21.10 VM) nothing happened after encrypting a wallet with private keys disabled.
But this option should be disabled for these wallets anyway.
However, this change does not prevent the user from creating a blank wallet (without disabling the private keys) and encrypting an empty wallet.
The crash is for descriptor wallet specifically. Legacy wallets will "encrypt" successfully.
Yes, blank wallets are not watchonly because they can have private keys imported. |
concept ACK
…On Fri, Jul 15, 2022 at 5:45 PM Andrew Chow ***@***.***> wrote:
Watchonly wallets do not have any private keys to encrypt. It does not
make sense to encrypt such wallets, so disable the option to encrypt them.
This avoids an assertion that can be hit when encrypting watchonly
descriptor wallets.
As our current behavior allows for encrypting watchonly wallets (no crash
with legacy, crash, but still encrypted with descriptors), the new NoKeys
status is only returned for unencrypted watchonly wallets. This allows any
watchonly wallets that were previously encrypted to show the correct
encryption status (they have encryption keys, and so should be indicated as
being encrypted).
------------------------------
You can view, comment on, or merge this pull request online at:
#631
Commit Summary
- 4c49541
<4c49541>
Disallow encryption of watchonly wallets
File Changes
(3 files <https://github.com/bitcoin-core/gui/pull/631/files>)
- *M* src/qt/bitcoingui.cpp
<https://github.com/bitcoin-core/gui/pull/631/files#diff-2ecf8cbf369cf3d2f3d2b1cf5cfe4c1a647d63e11e2885d2fd0ac11fb5f7a804>
(6)
- *M* src/qt/walletmodel.cpp
<https://github.com/bitcoin-core/gui/pull/631/files#diff-3c5f55f5118243d479461d5445315d9d27772fde1f1d86d828f26d113d1ba8ac>
(5)
- *M* src/qt/walletmodel.h
<https://github.com/bitcoin-core/gui/pull/631/files#diff-22574d424404ec3586264be2b71b9fa33c6e5a039f1209fb7693aaa2ae25f1db>
(1)
Patch Links:
- https://github.com/bitcoin-core/gui/pull/631.patch
- https://github.com/bitcoin-core/gui/pull/631.diff
—
Reply to this email directly, view it on GitHub
<#631>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMRS4W42QLK6KZCP3LLO2A3VUGBR3ANCNFSM53V7YK3A>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Concept ACK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK, 1 nit
@@ -71,6 +71,7 @@ class WalletModel : public QObject | |||
|
|||
enum EncryptionStatus | |||
{ | |||
NoKeys, // wallet->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Unsupported
seems like it would fit better here
Note: This could be rebased as far back as the v0.5.0 tag (or at the latest for 0.21 compatibility, 831675c) to cleanly merge to older branches. |
The issue reported on IRC:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes look sane. But I cannot reproduce the initially reported issue to make sure it has been fixed.
FWIW, here is the getwalletinfo
RPC output for my test watchonly descriptor wallet which I can encrypt with no crash:
{
"walletname": "220718d-v22-DisablePK.1",
"walletversion": 169900,
"format": "sqlite",
"balance": 0.00100000,
"unconfirmed_balance": 0.00000000,
"immature_balance": 0.00000000,
"txcount": 1,
"keypoolsize": 1000,
"keypoolsize_hd_internal": 0,
"paytxfee": 0.00000000,
"private_keys_enabled": false,
"avoid_reuse": false,
"scanning": false,
"descriptors": true,
"external_signer": false
}
The crash is for descriptor wallet specifically.
Could you provide steps to reproduce the issue reliably?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK
- I agree with the concept of this PR.
- Since encrypting a wallet ⇒ encrypting its private keys. And since a watch-only wallet has none, encrypting it doesn’t make sense.
- I was able to verify the code and confirm that encrypting a watch-only wallet in the GUI is disabled by this PR.
- However, I was also unable to reproduce the error on the master branch.
Create a new descriptor wallet with only private keys diasbled. It must not be marked as a blank wallet. This requires using the RPC to create the wallet as the GUI will always set the blank wallet flag. Then encrypt that wallet using the GUI and it will crash. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 4c49541, tested on Ubuntu 22.04.
4c49541 Disallow encryption of watchonly wallets (Andrew Chow) Pull request description: Watchonly wallets do not have any private keys to encrypt. It does not make sense to encrypt such wallets, so disable the option to encrypt them. This avoids an assertion that can be hit when encrypting watchonly descriptor wallets. As our current behavior allows for encrypting watchonly wallets (no crash with legacy, crash, but still encrypted with descriptors), the new `NoKeys` status is only returned for unencrypted watchonly wallets. This allows any watchonly wallets that were previously encrypted to show the correct encryption status (they have encryption keys, and so should be indicated as being encrypted). ACKs for top commit: w0xlt: tACK bitcoin-core/gui@4c49541 hebasto: ACK 4c49541, tested on Ubuntu 22.04. Tree-SHA512: 054dba0a8c1343a0df17689508cd628a974555828955a3c8820bf020868b95a3df98c47253b0ffe2252765b020160bb76ea21647d76d59ba748b3b41c481f2ae
Watchonly wallets do not have any private keys to encrypt. It does not make sense to encrypt such wallets, so disable the option to encrypt them. This avoids an assertion that can be hit when encrypting watchonly descriptor wallets. Github-Pull: bitcoin-core/gui#631 Rebased-From: 4c49541
Backported to the |
31ca698 Disallow encryption of watchonly wallets (Andrew Chow) da9578d build, qt: bump Qt5 version to 5.15.3 (Pavol Rusnak) Pull request description: Backports: - ef20add from #24668 to address #24939 and bitcoin-core/gui#638 - bitcoin-core/gui#631 Guix builds on `x86_64`: ``` 773f3555a1c6179d35a7a0b3971ced8eaf5a5e4bef5c08313216509506fe618d guix-build-31ca698f2017/output/aarch64-linux-gnu/SHA256SUMS.part ef3977b92daabffc2d153e15963a5703839bc04250d2784bc00dc1104112e79e guix-build-31ca698f2017/output/aarch64-linux-gnu/bitcoin-31ca698f2017-aarch64-linux-gnu-debug.tar.gz 65b2351c61d226a8b10fda36cc963fda1f5fb89ea6b463d7351fdcd67bd57c3e guix-build-31ca698f2017/output/aarch64-linux-gnu/bitcoin-31ca698f2017-aarch64-linux-gnu.tar.gz 41c3489300f81f714033aa45ca3a807c5005be0625ebf58234fd89f3cdc65a1d guix-build-31ca698f2017/output/arm-linux-gnueabihf/SHA256SUMS.part 45e6e4c9e2e35430c41bca6df36d5ed2f9a857934da46bfd920a499e03bddb61 guix-build-31ca698f2017/output/arm-linux-gnueabihf/bitcoin-31ca698f2017-arm-linux-gnueabihf-debug.tar.gz cf08e2a62c5a9bfdeaeee6ce69263dde8b56033aab650bb9ffafe8e9b9241519 guix-build-31ca698f2017/output/arm-linux-gnueabihf/bitcoin-31ca698f2017-arm-linux-gnueabihf.tar.gz 7d1f3e185fbb6843a1b5c47f7ff2a4452aa4a1f533bd7171f7fc8a13e65fde53 guix-build-31ca698f2017/output/arm64-apple-darwin/SHA256SUMS.part 6395ee2e17fd5a8891fc70d97e7d75810d677293b6ad8581334b2e289024210d guix-build-31ca698f2017/output/arm64-apple-darwin/bitcoin-31ca698f2017-arm64-apple-darwin-unsigned.dmg 1658de08323b366f0f39e9ed02d68072ee3bef2db2252235e71d8fd206b4e609 guix-build-31ca698f2017/output/arm64-apple-darwin/bitcoin-31ca698f2017-arm64-apple-darwin-unsigned.tar.gz c4fdf8d5563bdfc0390dec7adce2a0608f8e5b8d0d82b648ef38aed8ab72d996 guix-build-31ca698f2017/output/arm64-apple-darwin/bitcoin-31ca698f2017-arm64-apple-darwin.tar.gz 709470d5d1a4a44022cd3e7b162c8cf6c492c6bb9996eb31f12a121351ad081f guix-build-31ca698f2017/output/dist-archive/bitcoin-31ca698f2017.tar.gz 6f809a8bdd10fc62143b5d265ea9c2eae37a1b18cf573d4a3743b2b026c0d038 guix-build-31ca698f2017/output/powerpc64-linux-gnu/SHA256SUMS.part ff2f87a29f7581d9ce1fccb8749f4473d03532de2194373de0fcdcd3bf0d380a guix-build-31ca698f2017/output/powerpc64-linux-gnu/bitcoin-31ca698f2017-powerpc64-linux-gnu-debug.tar.gz ab5ec4203ff59c0d4885f5df1c91191a03a3c104ed8ca0e98e19f531914cd2ad guix-build-31ca698f2017/output/powerpc64-linux-gnu/bitcoin-31ca698f2017-powerpc64-linux-gnu.tar.gz beb0ed7d9940718351301cb27dda1ae7891092c85664e2f9473e81c02479c951 guix-build-31ca698f2017/output/powerpc64le-linux-gnu/SHA256SUMS.part 286121e5698b726abbfc24d972c00d9f16f6d841fab245980a376a51e8dd85bc guix-build-31ca698f2017/output/powerpc64le-linux-gnu/bitcoin-31ca698f2017-powerpc64le-linux-gnu-debug.tar.gz 04a12dfe6a036477d212877f301ee425dcf063abf0fd892b8fbc0497ee5612fc guix-build-31ca698f2017/output/powerpc64le-linux-gnu/bitcoin-31ca698f2017-powerpc64le-linux-gnu.tar.gz d229041d43c40a49bbebcb5b0700c540456e058e0cb7be0d3ac414a80018e4f9 guix-build-31ca698f2017/output/riscv64-linux-gnu/SHA256SUMS.part 981268b93caaf1c450f1f3cec4d70efd2b4779e17917a4ab424447743628519e guix-build-31ca698f2017/output/riscv64-linux-gnu/bitcoin-31ca698f2017-riscv64-linux-gnu-debug.tar.gz acfef50476d9141ec29855216e60974d6307307a02784e7217942ee281d69c76 guix-build-31ca698f2017/output/riscv64-linux-gnu/bitcoin-31ca698f2017-riscv64-linux-gnu.tar.gz 5482b0c34069be1e40a96a173f984c67eb983860a4f5f4d9d927638caf72eed5 guix-build-31ca698f2017/output/x86_64-apple-darwin/SHA256SUMS.part fe4847edbc3ad1c747663a67f0daf2ed8b38818d1d1960617d85c851b0dded2f guix-build-31ca698f2017/output/x86_64-apple-darwin/bitcoin-31ca698f2017-x86_64-apple-darwin-unsigned.dmg 2b1899804035508f90eef57e1f068120509e7680877c8ae6cb5cb5beed84607c guix-build-31ca698f2017/output/x86_64-apple-darwin/bitcoin-31ca698f2017-x86_64-apple-darwin-unsigned.tar.gz 7a82ab62d1db4141b13ac566bc985eca5fa1da982be29427dd74f7098059932c guix-build-31ca698f2017/output/x86_64-apple-darwin/bitcoin-31ca698f2017-x86_64-apple-darwin.tar.gz 3e943a6e11930ac1dcd7339bcdfbcf310b09f03d1e2544fce314e656b3552b7a guix-build-31ca698f2017/output/x86_64-linux-gnu/SHA256SUMS.part 0e0155ce76ffe8af19a74ecb74b813ce7ca4817bf3535a2b5813ae9e229804dc guix-build-31ca698f2017/output/x86_64-linux-gnu/bitcoin-31ca698f2017-x86_64-linux-gnu-debug.tar.gz b66f9a25e963db98b3b8eed79e6d280d0ae7902d1f7e2cdee8481bacfc94ed96 guix-build-31ca698f2017/output/x86_64-linux-gnu/bitcoin-31ca698f2017-x86_64-linux-gnu.tar.gz bdc9cdd0ba739c3aba3d355f6e9ea88af99b09dd666cf40c7986212b355d2a09 guix-build-31ca698f2017/output/x86_64-w64-mingw32/SHA256SUMS.part 815d4b70b257932a3e32e14d8bb53960efd5e71500e7349ac53d13303f4b5335 guix-build-31ca698f2017/output/x86_64-w64-mingw32/bitcoin-31ca698f2017-win64-debug.zip 4b248df85b0b5de00631756839bc53e9e64c764b4da900afad34f871e2afe995 guix-build-31ca698f2017/output/x86_64-w64-mingw32/bitcoin-31ca698f2017-win64-setup-unsigned.exe b26008ed9fa0db1d32220087c2f0828788f0f9f784c981622f5e76c63c98fb9a guix-build-31ca698f2017/output/x86_64-w64-mingw32/bitcoin-31ca698f2017-win64-unsigned.tar.gz 4dd03a68ac2d742681d6b8c42b15e6f9d4ce46084ff18ebb0f1313109a867205 guix-build-31ca698f2017/output/x86_64-w64-mingw32/bitcoin-31ca698f2017-win64.zip ``` ACKs for top commit: jarolrod: ACK 31ca698 Tree-SHA512: 596c2979e070d3574c744ac89961ba157e9e01c2e1a3ce7d33cc369ad2cf1c2e16aa23209b382667dbd100545b5c17530771855b380eeb7345deebfa695a3be6
Watchonly wallets do not have any private keys to encrypt. It does not make sense to encrypt such wallets, so disable the option to encrypt them. This avoids an assertion that can be hit when encrypting watchonly descriptor wallets. Github-Pull: bitcoin-core/gui#631 Rebased-From: 4c49541
Backported to the |
272fa25 Fixes #26490 by preventing notifications (John Moffett) 7b7bbc1 Disallow encryption of watchonly wallets (Andrew Chow) Pull request description: Backports: - bitcoin-core/gui#631 - bitcoin-core/gui#680 ACKs for top commit: jarolrod: ACK 272fa25 Tree-SHA512: 4c285327464240ace3884d9653cc46d8e7b60b888f3b096ceb4fd5000d084ea8d97f1ef86ca1dea8dc7d3be8cdd2da19eece2b8c5b7351c5961b50b78fcd4c4d
d9bd628 doc: add release notes for 22.1rc2 (fanquake) 6523107 doc: Update manual pages for 22.1rc2 (fanquake) 6af7af6 build: Bump version to 22.1rc2 (fanquake) Pull request description: Bump the version to 22.1rc2. Regenerate the man pages. Add WIP 22.1 release notes. Changes since rc1: - bitcoin-core/gui#631 - bitcoin-core/gui#680 ACKs for top commit: stickies-v: ACK [d9bd628](d9bd628) jarolrod: ACK d9bd628 Tree-SHA512: 70b1723fd5f77a93763ffc153b18c5d6c11c8294828406bd5e93daf9e8aac5e62306280ef6601508b4d22e1cce5136687afc826be6d159816071549849c40f91
Watchonly wallets do not have any private keys to encrypt. It does not make sense to encrypt such wallets, so disable the option to encrypt them. This avoids an assertion that can be hit when encrypting watchonly descriptor wallets. Github-Pull: bitcoin-core/gui#631 Rebased-From: 4c49541 (cherry picked from commit 7b7bbc1)
Watchonly wallets do not have any private keys to encrypt. It does not make sense to encrypt such wallets, so disable the option to encrypt them. This avoids an assertion that can be hit when encrypting watchonly descriptor wallets. Github-Pull: bitcoin-core/gui#631 Rebased-From: 4c49541 (cherry picked from commit 7b7bbc1)
Watchonly wallets do not have any private keys to encrypt. It does not make sense to encrypt such wallets, so disable the option to encrypt them. This avoids an assertion that can be hit when encrypting watchonly descriptor wallets. Github-Pull: bitcoin-core/gui#631 Rebased-From: 4c49541 (cherry picked from commit 7b7bbc1)
Watchonly wallets do not have any private keys to encrypt. It does not make sense to encrypt such wallets, so disable the option to encrypt them. This avoids an assertion that can be hit when encrypting watchonly descriptor wallets. Github-Pull: bitcoin-core/gui#631 Rebased-From: 4c49541 (cherry picked from commit 7b7bbc1)
Watchonly wallets do not have any private keys to encrypt. It does not make sense to encrypt such wallets, so disable the option to encrypt them. This avoids an assertion that can be hit when encrypting watchonly descriptor wallets. Github-Pull: bitcoin-core/gui#631 Rebased-From: 4c49541
Watchonly wallets do not have any private keys to encrypt. It does not make sense to encrypt such wallets, so disable the option to encrypt them.
This avoids an assertion that can be hit when encrypting watchonly descriptor wallets.
As our current behavior allows for encrypting watchonly wallets (no crash with legacy, crash, but still encrypted with descriptors), the new
NoKeys
status is only returned for unencrypted watchonly wallets. This allows any watchonly wallets that were previously encrypted to show the correct encryption status (they have encryption keys, and so should be indicated as being encrypted).