diff options
author | Ben Woosley <ben.woosley@gmail.com> | 2018-11-13 04:57:10 +0000 |
---|---|---|
committer | Ben Woosley <ben.woosley@gmail.com> | 2018-11-13 12:51:16 -0500 |
commit | bd3b0361d840bff95988a048abf70ade94d80524 (patch) | |
tree | 4c542682c6aac615aa2cc1760fef4faba7195d52 /src/wallet/rpcwallet.cpp | |
parent | 3002d6cf31821622e9f21d51e536cafc5cfb10ae (diff) |
Add stop_block out arg to ScanForWalletTransactions
Accurately reports the last block successfully scanned, replacing a return of
the chain tip, which represented possibly inaccurated data in a race condition.
Diffstat (limited to 'src/wallet/rpcwallet.cpp')
-rw-r--r-- | src/wallet/rpcwallet.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index c3f12f373d..3c92eb3120 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3332,13 +3332,12 @@ UniValue rescanblockchain(const JSONRPCRequest& request) } } - const CBlockIndex* stopBlock; + const CBlockIndex *failed_block, *stopBlock; CWallet::ScanResult result = - pwallet->ScanForWalletTransactions(pindexStart, pindexStop, reserver, stopBlock, true); + pwallet->ScanForWalletTransactions(pindexStart, pindexStop, reserver, failed_block, stopBlock, true); switch (result) { case CWallet::ScanResult::SUCCESS: - stopBlock = pindexStop ? pindexStop : pChainTip; - break; + break; // stopBlock set by ScanForWalletTransactions case CWallet::ScanResult::FAILURE: throw JSONRPCError(RPC_MISC_ERROR, "Rescan failed. Potentially corrupted data files."); case CWallet::ScanResult::USER_ABORT: |