-
Notifications
You must be signed in to change notification settings - Fork 37.7k
wallet: Make scan / abort status private to CWallet #14942
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
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. |
a71986a
to
94accf9
Compare
Rebased and substantially refocused this PR to:
|
fd61c8b
to
4cfd0a8
Compare
4cfd0a8
to
9d6a502
Compare
9d6a502
to
741f2fe
Compare
741f2fe
to
4b4cf7c
Compare
Rebased |
looks like a nice refactor utACK 4b4cf7c |
4b4cf7c
to
469117d
Compare
Rebased, and restored |
not sure why github tends to screw up range-diffs sometimes but here's the last one:
1: 99a72728a6 = 1: c82f6c7806 Return ScanResult from CWallet::RescanFromTime
2: 4b4cf7cc28 ! 2: 469117d55c Make scan / abort status private to CWallet
@@ -2,7 +2,7 @@
Make scan / abort status private to CWallet
- Drop CWallet::IsAbortingRescan and IsScanning by reporting the abort
+ Drop CWallet::IsAbortingRescan by reporting the abort
effectuality from CWallet::AbortScan.
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
@@ -54,8 +54,7 @@
*/
- void AbortRescan() { fAbortRescan = true; }
- bool IsAbortingRescan() { return fAbortRescan; }
-- bool IsScanning() { return fScanningWallet; }
+ bool AbortRescan();
-
- /**
- * keystore implementation
+ bool IsScanning() { return fScanningWallet; }
+ int64_t ScanningDuration() const { return fScanningWallet ? GetTimeMillis() - m_scanning_start : 0; }
+ double ScanningProgress() const { return fScanningWallet ? (double) m_scanning_progress : 0; } re-utACK 469117d |
469117d
to
c26c232
Compare
c26c232
to
319aeba
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.
Looks like an improvement. Left comments.
* exist in the wallet will be updated. | ||
* | ||
* @param[in] start_block Scan starting block. If block is not on the active | ||
* chain, the scan will return SUCCESS immediately. |
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 feels weird to me, and feels like it should have a new ORPHAN_CHAIN
ScanResult
, even if this is handled the same way as SUCCESS
everywhere right now.
@@ -169,6 +169,13 @@ std::shared_ptr<CWallet> LoadWallet(interfaces::Chain& chain, const std::string& | |||
return LoadWallet(chain, WalletLocation(name), error, warnings); | |||
} | |||
|
|||
bool CWallet::AbortRescan() |
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.
Looks like you could have a race in this method?
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.
It's a bit convoluted, but I think it's handled gracefully: if fScanningWallet
is set to false
as fAbortRescan
is being set to true
(i.e. at the end of a scan), there is no issue as ScanForWalletTransactions
sets fAbortRescan
to false
at its start.
BTW this behavior is unchanged - here's the prior implementation: https://github.com/bitcoin/bitcoin/pull/14942/files#diff-522490d83dce5375d423b23886e4125eL217-R219
if (!pwallet->IsScanning() || pwallet->IsAbortingRescan()) return false; | ||
pwallet->AbortRescan(); | ||
return true; | ||
return pwallet->AbortRescan(); |
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.
Why does it matter the return value? Isn't even documented.
Lookup the failed time just in the case it's needed.
Drop CWallet::IsAbortingRescan by reporting the abort effectuality from CWallet::AbortScan.
And move to the header.
319aeba
to
71b9360
Compare
🐙 This pull request conflicts with the target branch and needs rebase. |
Any plans for this? It's needed rebase for more than a year, no other activity. |
There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
Closing for now due to inactivity for more than a year. Can be reopened anytime. Just leave a comment here or in IRC. |
By returning
ScanResult
fromRescanFromTime
and reporting the effectuality ofAbortScan
.And consolidate rpc-level error handling across
RescanFromTime
andScanForWalletTransactions
.Note this changes the
rescanblockchain
scan failure error fromRPC_MISC_ERROR
toRPC_WALLET_ERROR
, which seems more appropriate and matches thebehavior from the rpcdump methods.
This follows up on #13076.