-
Notifications
You must be signed in to change notification settings - Fork 38.7k
[moveonly] Extract RescanWallet to handle a simple rescan #13658
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
Conversation
src/wallet/wallet.h
Outdated
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.
Is there any reason why not just leave this here? It could very well be used by the gui or some other interface to the wallet in the future and had to be moved back. Generally, I'd prefer if code was only moved when necessary, since unnecessary code movement/refactoring makes backports easier to mess up and consumes scarce review resources.
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.
This move reduces the surface area of CWallet, which is pretty sprawling at the moment (wallet.cpp is ~4500 lines, the 3rd-largest *.cpp file, and the largest outside /qt/), and localizes this code to one implementation file from being more broadly available (wallet.h is included into 26 files).
Grant the concerns you note are serious, and we should draw the line somewhere, but if the codebase is to be in play for a long time, it needs to evolve and progress. Moving incrementally toward minimizing scope of code, dependencies, etc. is attractive from that perspective as it should have payoffs in reducing the overall complexity of the codebase, which should ease changes on an ongoing and cumulative basis.
Other approaches to making better use of scarce review resources come to mind:
- I've thought of implementing a web site to helps rank PRs by ACKs and other indications of importance. Current solutions like: https://github.com/bitcoin/bitcoin/projects/8 are pretty limited and not decentralized and ACKs are not currently well-exposed across PRs in aggregate.
- We could add a feature to output the changes between force pushes to the same PR, so that reviewers could review just the incremental subset, and the historical changes are recorded.
- We could potentially examine and report changes to the build output to give reviewers a sense of the consequence to the output to the binaries.
Seems like these are the sorts of things that will help the project to scale and accelerate.
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.
I've thought of implementing a web site to helps rank PRs by ACKs and other indications of importance. Current solutions like: https://github.com/bitcoin/bitcoin/projects/8 are pretty limited and not decentralized and ACKs are not currently well-exposed across PRs in aggregate.
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.
Nice, hadn't see that. 👍
|
This refactor raises the following questions:
|
c764dd6 to
65c06a3
Compare
|
Updated to minimize |
Note to reviewers: 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. |
|
I don't like this. Code that interacts with the wallet should be in the wallet, not in the RPC code. I'm aware that there is an enormous amount of internal logic already in the RPC code, but we should be moving stuff in the other direction. |
|
utACK second commit, if the first one is dropped. |
Where the outcome does not depend on the result, apart from a simple success check.
|
Dropped the first commit, and added handling of the ShutdownRequested rescan abort condition: Lines 1759 to 1763 in b25a4c2
|
|
Added full handing of rescan failure conditions to |
|
Kind of NACK the current approach. If you want to touch this consider improving enum WalletScanError
{
NONE = 0, // when ScanForWalletTransactions return is true
ABORTED,
SHUTDOWN_REQUEST,
};
struct WalletScanResult {
WalletScanError error;
std::string message;
// other outputs
};
bool CWallet::ScanForWalletTransactions(WalletScanResult& result, ...);This way the callers don't have to check what caused the error. Edit: I like the |
|
@promag I did something like that here #13076, and while I think the result is ok, I've been thinking more of updating it to return bool as prompted by jimpo in #13582: Have that follow-up in mind. |
|
I'll split these up for separate consideration. |
|
utACK 3fe836b. Side note, not sure if this should be tagged moveonly. |
|
utACK 3fe836b |
| static const bool DEFAULT_WALLETBROADCAST = true; | ||
| static const bool DEFAULT_DISABLE_WALLET = false; | ||
|
|
||
| static const int64_t TIMESTAMP_MIN = 0; |
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.
good to move this locally, it's a really aspecific constant name
3fe836b [moveonly] Extract RescanWallet to handle a simple rescan (Ben Woosley) Pull request description: Where the outcome does not depend on the result, apart from a simple success check. Tree-SHA512: e0d29c6fc0c7f99a730289e5a80deb586b2848aead56b5198a71ef01f65374812468dfd57be0b8b076eb9be4090d5101d28d979a1d5c3d2f1caeca77b303e90e
Summary: 3fe836b [moveonly] Extract RescanWallet to handle a simple rescan (Ben Woosley) Pull request description: Where the outcome does not depend on the result, apart from a simple success check. Tree-SHA512: e0d29c6fc0c7f99a730289e5a80deb586b2848aead56b5198a71ef01f65374812468dfd57be0b8b076eb9be4090d5101d28d979a1d5c3d2f1caeca77b303e90e Backport of Core PR12658 bitcoin/bitcoin#13658 Test Plan: make check ./bitcoin-qt -> help -> debug -> console -> rescanblockchain ./bitcoind ./bitcoin-cli rescanblockchain Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Reviewed By: jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D4020
…le rescan 3fe836b [moveonly] Extract RescanWallet to handle a simple rescan (Ben Woosley) Pull request description: Where the outcome does not depend on the result, apart from a simple success check. Tree-SHA512: e0d29c6fc0c7f99a730289e5a80deb586b2848aead56b5198a71ef01f65374812468dfd57be0b8b076eb9be4090d5101d28d979a1d5c3d2f1caeca77b303e90e
…le rescan 3fe836b [moveonly] Extract RescanWallet to handle a simple rescan (Ben Woosley) Pull request description: Where the outcome does not depend on the result, apart from a simple success check. Tree-SHA512: e0d29c6fc0c7f99a730289e5a80deb586b2848aead56b5198a71ef01f65374812468dfd57be0b8b076eb9be4090d5101d28d979a1d5c3d2f1caeca77b303e90e
Where the outcome does not depend on the result, apart from a simple
success check.