-
Notifications
You must be signed in to change notification settings - Fork 36.2k
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
Fix rescanblockchain rpc to properly report progress #13079
Fix rescanblockchain rpc to properly report progress #13079
Conversation
src/wallet/wallet.cpp
Outdated
RescanVerificationProgress(const CWallet& wallet, const CBlockIndex* const stop_block) | ||
: m_wallet(wallet), m_time(GetTime()), m_stop_block(stop_block) {} | ||
|
||
void Start(const CBlockIndex* const start_block) |
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.
simpler to RAII this instead of a separate Constructor/Start/AnnounceStart methods?
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.
The main reason I kept this separate is that GuessVerificationProgress
needs cs_main
held, and I wanted to minimize the amount of code in the lock-block.
b5fe7a2
to
409db40
Compare
Removed the refactoring for easier review. |
Makes sense. Reporting progress for partial rescans based on the given range seems to be more logical. |
src/wallet/wallet.cpp
Outdated
@@ -1742,9 +1742,13 @@ CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, CBlock | |||
double dProgressTip; |
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.
should probably be called progress_end
src/wallet/wallet.cpp
Outdated
dProgressStart = GuessVerificationProgress(chainParams.TxData(), pindex); | ||
dProgressTip = GuessVerificationProgress(chainParams.TxData(), tip); | ||
if (pindexStop == nullptr) { | ||
tip = chainActive.Tip() |
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.
missing semicolon, also wrong indentation.
utACK 409db40 |
From travis:
|
409db40
to
d700433
Compare
Added semicolon, renamed progress vars to |
CWallet::ScanForWalletTransactions did not previously take into account pindexStop when calculating progress. Renamed progress vars to progress_*. rescanblockchain is the only rpc that uses this parameter.
d700433
to
16be133
Compare
Rebased |
utACK 16be133 |
1 similar comment
utACK 16be133 |
Tested ACK 16be133 |
16be133 Fix rescanblockchain rpc to property report progress (Ben Woosley) Pull request description: Previously it assumed tip in all cases. This also extracts a RescanVerificationProgress helper object whose role is to manage reporting, in order to simplify ScanForWalletTransactions - more lines in total, but much simpler to follow the core logic. Tree-SHA512: 5ebed0c56fae4ccfe613ff1d7082cb6da5a86635a8993ed3af70b500a4ea43074121aea9219b2f0321fbfeb7efcb964bdc2199297a64ca0fa85d9d07aa637d40
utACK 16be133. |
Summary: 16be133 Fix rescanblockchain rpc to property report progress (Ben Woosley) Pull request description: Previously it assumed tip in all cases. This also extracts a RescanVerificationProgress helper object whose role is to manage reporting, in order to simplify ScanForWalletTransactions - more lines in total, but much simpler to follow the core logic. Tree-SHA512: 5ebed0c56fae4ccfe613ff1d7082cb6da5a86635a8993ed3af70b500a4ea43074121aea9219b2f0321fbfeb7efcb964bdc2199297a64ca0fa85d9d07aa637d40 Backport of Core PR13079 bitcoin/bitcoin#13079 Test Plan: make check ./bitcoind --printtoconsole ./bitcoin-cli rescanblockchain 0 1300000 Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Reviewed By: deadalnix, Fabien, O1 Bitcoin ABC, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D4112
Summary: 16be13345 Fix rescanblockchain rpc to property report progress (Ben Woosley) Pull request description: Previously it assumed tip in all cases. This also extracts a RescanVerificationProgress helper object whose role is to manage reporting, in order to simplify ScanForWalletTransactions - more lines in total, but much simpler to follow the core logic. Tree-SHA512: 5ebed0c56fae4ccfe613ff1d7082cb6da5a86635a8993ed3af70b500a4ea43074121aea9219b2f0321fbfeb7efcb964bdc2199297a64ca0fa85d9d07aa637d40 Backport of Core PR13079 bitcoin/bitcoin#13079 Test Plan: make check ./bitcoind --printtoconsole ./bitcoin-cli rescanblockchain 0 1300000 Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Reviewed By: deadalnix, Fabien, O1 Bitcoin ABC, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D4112
Summary: 16be13345 Fix rescanblockchain rpc to property report progress (Ben Woosley) Pull request description: Previously it assumed tip in all cases. This also extracts a RescanVerificationProgress helper object whose role is to manage reporting, in order to simplify ScanForWalletTransactions - more lines in total, but much simpler to follow the core logic. Tree-SHA512: 5ebed0c56fae4ccfe613ff1d7082cb6da5a86635a8993ed3af70b500a4ea43074121aea9219b2f0321fbfeb7efcb964bdc2199297a64ca0fa85d9d07aa637d40 Backport of Core PR13079 bitcoin/bitcoin#13079 Test Plan: make check ./bitcoind --printtoconsole ./bitcoin-cli rescanblockchain 0 1300000 Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Reviewed By: deadalnix, Fabien, O1 Bitcoin ABC, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D4112
Summary: 16be13345 Fix rescanblockchain rpc to property report progress (Ben Woosley) Pull request description: Previously it assumed tip in all cases. This also extracts a RescanVerificationProgress helper object whose role is to manage reporting, in order to simplify ScanForWalletTransactions - more lines in total, but much simpler to follow the core logic. Tree-SHA512: 5ebed0c56fae4ccfe613ff1d7082cb6da5a86635a8993ed3af70b500a4ea43074121aea9219b2f0321fbfeb7efcb964bdc2199297a64ca0fa85d9d07aa637d40 Backport of Core PR13079 bitcoin/bitcoin#13079 Test Plan: make check ./bitcoind --printtoconsole ./bitcoin-cli rescanblockchain 0 1300000 Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Reviewed By: deadalnix, Fabien, O1 Bitcoin ABC, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D4112
…ress 16be133 Fix rescanblockchain rpc to property report progress (Ben Woosley) Pull request description: Previously it assumed tip in all cases. This also extracts a RescanVerificationProgress helper object whose role is to manage reporting, in order to simplify ScanForWalletTransactions - more lines in total, but much simpler to follow the core logic. Tree-SHA512: 5ebed0c56fae4ccfe613ff1d7082cb6da5a86635a8993ed3af70b500a4ea43074121aea9219b2f0321fbfeb7efcb964bdc2199297a64ca0fa85d9d07aa637d40
…ress 16be133 Fix rescanblockchain rpc to property report progress (Ben Woosley) Pull request description: Previously it assumed tip in all cases. This also extracts a RescanVerificationProgress helper object whose role is to manage reporting, in order to simplify ScanForWalletTransactions - more lines in total, but much simpler to follow the core logic. Tree-SHA512: 5ebed0c56fae4ccfe613ff1d7082cb6da5a86635a8993ed3af70b500a4ea43074121aea9219b2f0321fbfeb7efcb964bdc2199297a64ca0fa85d9d07aa637d40
…ress 16be133 Fix rescanblockchain rpc to property report progress (Ben Woosley) Pull request description: Previously it assumed tip in all cases. This also extracts a RescanVerificationProgress helper object whose role is to manage reporting, in order to simplify ScanForWalletTransactions - more lines in total, but much simpler to follow the core logic. Tree-SHA512: 5ebed0c56fae4ccfe613ff1d7082cb6da5a86635a8993ed3af70b500a4ea43074121aea9219b2f0321fbfeb7efcb964bdc2199297a64ca0fa85d9d07aa637d40
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.
U
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.
Sorce
Previously it assumed tip in all cases. This also extracts a RescanVerificationProgress helper object whose role is to manage reporting, in order to simplify ScanForWalletTransactions - more lines in total, but much simpler to follow the core logic.