-
Notifications
You must be signed in to change notification settings - Fork 36.7k
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
wallet: LearnRelatedScripts only if KeepDestination #17237
wallet: LearnRelatedScripts only if KeepDestination #17237
Conversation
c2edd41
to
d4643bf
Compare
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
Can you elaborate a bit, what the difference is here? Does it fix an issue, or is it just a conceptual refactor? |
This is not a refactor, it prevents a call to Updated OP. I'll see if I can add a test that fails without this change. |
Code review ACK d4643bf |
d4643bf
to
ee9fc9b
Compare
ee9fc9b
to
c108c0d
Compare
c108c0d
to
3958295
Compare
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 review ACK 3958295. I like this change. The new behavior makes more sense, and the change makes the code clearer, since the current LearnRelatedScripts call is hard to understand and explain. (Personally, I'd like it if this PR were merged before #17373 or that PR was rebased on top of this one so it would be less confusing.)
re: #17237 (comment)
I'll see if I can add a test that fails without this change.
A test would be nice to have either here or in a followup PR. I think we really need to get out of the habit of making behavior changes in the wallet without corresponding test changes. Not having tests is dangerous and also impedes code review because test changes can make it easier to see what code changes are doing.
Re-ACK 3958295 |
@Sjors do you want to review this? I'm not sure who else would be familiar |
ACK 3958295 A test could, I'll just shamelessly plug #12134 again, create a pre-segwit wallet, open it on master, draft a transaction with a SegWit change address, cancel it, downgrade to pre-segwit bitcoin core wallet, and then check that older wallet version don't see the key. But I don't think that's terribly useful. |
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.
utACK 3958295
3958295 wallet: LearnRelatedScripts only if KeepDestination (João Barbosa) 55295fb wallet: Lock address type in ReserveDestination (João Barbosa) Pull request description: Only mutates the wallet if the reserved key is kept. First commit is a refactor that makes the address type a class member. The second commit moves `LearnRelatedScripts` from `GetReservedDestination` to `KeepDestination` to avoid an unnecessary call to `AddCScript` - which in turn prevents multiple entries of the same script in the wallet DB. ACKs for top commit: achow101: Re-ACK 3958295 Sjors: ACK 3958295 ryanofsky: Code review ACK 3958295. I like this change. The new behavior makes more sense, and the change makes the code clearer, since the current LearnRelatedScripts call is hard to understand and explain. (Personally, I'd like it if this PR were merged before #17373 or that PR was rebased on top of this one so it would be less confusing.) meshcollider: utACK 3958295 Tree-SHA512: 49a5f4b022b28042ad37ea309b28378a3983cb904e234a25795b5a360356652e0f8e60f15e3e64d85094ea63af9be01812d90ccfc08ca4f1dd927fdd8566e33f
3958295 wallet: LearnRelatedScripts only if KeepDestination (João Barbosa) 55295fb wallet: Lock address type in ReserveDestination (João Barbosa) Pull request description: Only mutates the wallet if the reserved key is kept. First commit is a refactor that makes the address type a class member. The second commit moves `LearnRelatedScripts` from `GetReservedDestination` to `KeepDestination` to avoid an unnecessary call to `AddCScript` - which in turn prevents multiple entries of the same script in the wallet DB. ACKs for top commit: achow101: Re-ACK 3958295 Sjors: ACK 3958295 ryanofsky: Code review ACK 3958295. I like this change. The new behavior makes more sense, and the change makes the code clearer, since the current LearnRelatedScripts call is hard to understand and explain. (Personally, I'd like it if this PR were merged before bitcoin#17373 or that PR was rebased on top of this one so it would be less confusing.) meshcollider: utACK 3958295 Tree-SHA512: 49a5f4b022b28042ad37ea309b28378a3983cb904e234a25795b5a360356652e0f8e60f15e3e64d85094ea63af9be01812d90ccfc08ca4f1dd927fdd8566e33f
Summary: bitcoin/bitcoin@55295fb Partial backport of Core [[bitcoin/bitcoin#17237 | PR17237]] Test Plan: ninja check check-functional Reviewers: #bitcoin_abc, jasonbcox, deadalnix Reviewed By: #bitcoin_abc, jasonbcox, deadalnix Subscribers: jasonbcox Differential Revision: https://reviews.bitcoinabc.org/D7689
Summary: bitcoin/bitcoin@3958295 Depends on D7689 Concludes backport of Core [[bitcoin/bitcoin#17237 | PR17237]] Test Plan: ninja check check-functional Reviewers: #bitcoin_abc, deadalnix, jasonbcox Reviewed By: #bitcoin_abc, deadalnix, jasonbcox Subscribers: deadalnix Differential Revision: https://reviews.bitcoinabc.org/D7690
3958295 wallet: LearnRelatedScripts only if KeepDestination (João Barbosa) 55295fb wallet: Lock address type in ReserveDestination (João Barbosa) Pull request description: Only mutates the wallet if the reserved key is kept. First commit is a refactor that makes the address type a class member. The second commit moves `LearnRelatedScripts` from `GetReservedDestination` to `KeepDestination` to avoid an unnecessary call to `AddCScript` - which in turn prevents multiple entries of the same script in the wallet DB. ACKs for top commit: achow101: Re-ACK 3958295 Sjors: ACK 3958295 ryanofsky: Code review ACK 3958295. I like this change. The new behavior makes more sense, and the change makes the code clearer, since the current LearnRelatedScripts call is hard to understand and explain. (Personally, I'd like it if this PR were merged before bitcoin#17373 or that PR was rebased on top of this one so it would be less confusing.) meshcollider: utACK 3958295 Tree-SHA512: 49a5f4b022b28042ad37ea309b28378a3983cb904e234a25795b5a360356652e0f8e60f15e3e64d85094ea63af9be01812d90ccfc08ca4f1dd927fdd8566e33f
Only mutates the wallet if the reserved key is kept.
First commit is a refactor that makes the address type a class member.
The second commit moves
LearnRelatedScripts
fromGetReservedDestination
toKeepDestination
to avoid an unnecessary call toAddCScript
- which in turn prevents multiple entries of the same script in the wallet DB.