Activate watchonly wallet behavior for LegacySPKM only#17677
Activate watchonly wallet behavior for LegacySPKM only#17677meshcollider merged 1 commit intobitcoin:masterfrom
Conversation
|
conversation ensued on IRC after reading #16373 (comment) since this pattern should be followed in each place we use this behavior for LegacyScriptPubKeyMan |
src/wallet/wallet.cpp
Outdated
There was a problem hiding this comment.
Note to other reviewers: ISMINE_ALL = ISMINE_WATCH_ONLY | ISMINE_SPENDABLE. When WALLET_FLAG_DISABLE_PRIVATE_KEYS is set, no coins can be ISMINE_SPENDABLE. Therefore ISMINE_ALL leads to the same behavior as ISMINE_WATCH_ONLY
|
This isn't quite what I was thinking. The thought was that you would do either checking for LegacyScrriptPubKeyMan or ISMINE_ALL, not both. Since ISMINE_WATCHONLY is not intended to be used outside of LegacyScriptPubKeyMan, you could just check for whether it's LegacySPKM and set ISMINE_WATCHONLY if it is. Otherwise you just use ISMINE_SPENDABLE. Alternatively, because ISMINE_ALL is I don't think doing both of those things are necessary. |
7f8046e to
6beb900
Compare
|
If I have to choose, I'll stick with the Legacy check + ISMINE_WATCH_ONLY since it's easier for me to understand the purpose/scope of the code. Updated. |
|
ACK 6beb900c0cdf86f40ca5e75f3c77b3d0461ea7a3 |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
jonatack
left a comment
There was a problem hiding this comment.
ACK 6beb900 modulo question and suggestions below. Code review/built/ran tests. Would test coverage be helpful here?
src/qt/sendcoinsdialog.cpp
Outdated
There was a problem hiding this comment.
Suggestion:
- // Include watch-only for wallets without private key
+ // Include watch-only for LegacyScriptPubKeyMan wallets without private keys.
src/wallet/wallet.cpp
Outdated
There was a problem hiding this comment.
Suggestion:
- // Include watch-only for wallets without private keys
+ // Include watch-only for LegacyScriptPubKeyMan wallets without private keys.6beb900 to
e1e1442
Compare
|
Reduced changes as per discussion to just affecting the ismine filter, rather than |
|
ACK e1e1442 |
|
This smaller diff in e1e1442 seems good and the build/tests pass. Started looking at a test which, per @instagibbs suggestion, would define a new spk_man, add watchonly coins, then check they aren't returned by ListCoins. |
meshcollider
left a comment
There was a problem hiding this comment.
Code review ACK e1e1442
e1e1442 Activate no-privkey -> ISMINE_WATCH_ONLY behavior for LegacySPKM only (Gregory Sanders) Pull request description: Slight cleanup following #16944 This should allow future scriptpubkeymans to transparently work, since the current plan is to have ismine always be spendable. ACKs for top commit: achow101: ACK e1e1442 Sjors: Code review ACK e1e1442 meshcollider: Code review ACK e1e1442 Tree-SHA512: c0a86587d33b8b1646494a5cb0bf8681ee4a88e6913918157746943a0996b501903e0e6ee954cf04154c1e0faee0cbb375c74ca789f46ba9244eb5296632b042
…M only e1e1442 Activate no-privkey -> ISMINE_WATCH_ONLY behavior for LegacySPKM only (Gregory Sanders) Pull request description: Slight cleanup following bitcoin#16944 This should allow future scriptpubkeymans to transparently work, since the current plan is to have ismine always be spendable. ACKs for top commit: achow101: ACK e1e1442 Sjors: Code review ACK e1e1442 meshcollider: Code review ACK e1e1442 Tree-SHA512: c0a86587d33b8b1646494a5cb0bf8681ee4a88e6913918157746943a0996b501903e0e6ee954cf04154c1e0faee0cbb375c74ca789f46ba9244eb5296632b042
Summary: e1e1442f3eadc1d139380e71c1b60b86d8d6bdee Activate no-privkey -> ISMINE_WATCH_ONLY behavior for LegacySPKM only (Gregory Sanders) Pull request description: Slight cleanup following bitcoin/bitcoin#16944 This should allow future scriptpubkeymans to transparently work, since the current plan is to have ismine always be spendable. --- Backport of Core [[bitcoin/bitcoin#17677 | PR17677]] Test Plan: ninja all check check-functional Reviewers: #bitcoin_abc, jasonbcox Reviewed By: #bitcoin_abc, jasonbcox Differential Revision: https://reviews.bitcoinabc.org/D7728
…M only e1e1442 Activate no-privkey -> ISMINE_WATCH_ONLY behavior for LegacySPKM only (Gregory Sanders) Pull request description: Slight cleanup following bitcoin#16944 This should allow future scriptpubkeymans to transparently work, since the current plan is to have ismine always be spendable. ACKs for top commit: achow101: ACK e1e1442 Sjors: Code review ACK e1e1442 meshcollider: Code review ACK e1e1442 Tree-SHA512: c0a86587d33b8b1646494a5cb0bf8681ee4a88e6913918157746943a0996b501903e0e6ee954cf04154c1e0faee0cbb375c74ca789f46ba9244eb5296632b042
Slight cleanup following #16944
This should allow future scriptpubkeymans to transparently work, since the current plan is to have ismine always be spendable.