Merge #15901: wallet: log on rescan completion

1b602f6fe remove extraneous scope (andrewtoth)
6ad372a97 wallet: log on rescan completion (andrewtoth)

Pull request description:

  Currently there is nothing logged when a rescan completes successfully. This leaves the last log message something like:
  ```
   Still rescanning. At block 573037. Progress=0.998415
  ```
  It is unclear when the rescan actually finished. This adds a `Rescan completed.` message to make it more clear.

ACKs for commit 1b602f:
  Empact:
    utACK 1b602f6fed
  meshcollider:
    utACK 1b602f6fed

Tree-SHA512: 618d646a0f143c2372f1db91c14e7f677b39fb3a2957e887cbc349971c3e8953bc017e2028ac489368c20dbb9a7265c4c2d448c95de785366acfe0e576f1be66
This commit is contained in:
MeshCollider 2019-04-28 12:08:55 +12:00
commit bdd7217f2c
No known key found for this signature in database
GPG key ID: D300116E1C875A3D

View file

@ -1771,6 +1771,7 @@ int64_t CWallet::RescanFromTime(int64_t startTime, const WalletRescanReserver& r
CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_block, const uint256& stop_block, const WalletRescanReserver& reserver, bool fUpdate) CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_block, const uint256& stop_block, const WalletRescanReserver& reserver, bool fUpdate)
{ {
int64_t nNow = GetTime(); int64_t nNow = GetTime();
int64_t start_time = GetTimeMillis();
assert(reserver.isReserved()); assert(reserver.isReserved());
@ -1779,7 +1780,6 @@ CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_bloc
WalletLogPrintf("Rescan started from block %s...\n", start_block.ToString()); WalletLogPrintf("Rescan started from block %s...\n", start_block.ToString());
{
fAbortRescan = false; fAbortRescan = false;
ShowProgress(strprintf("%s " + _("Rescanning..."), GetDisplayName()), 0); // show rescan progress in GUI as dialog or on splashscreen, if -rescan on startup ShowProgress(strprintf("%s " + _("Rescanning..."), GetDisplayName()), 0); // show rescan progress in GUI as dialog or on splashscreen, if -rescan on startup
uint256 tip_hash; uint256 tip_hash;
@ -1862,7 +1862,8 @@ CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_bloc
} else if (block_height && chain().shutdownRequested()) { } else if (block_height && chain().shutdownRequested()) {
WalletLogPrintf("Rescan interrupted by shutdown request at block %d. Progress=%f\n", *block_height, progress_current); WalletLogPrintf("Rescan interrupted by shutdown request at block %d. Progress=%f\n", *block_height, progress_current);
result.status = ScanResult::USER_ABORT; result.status = ScanResult::USER_ABORT;
} } else {
WalletLogPrintf("Rescan completed in %15dms\n", GetTimeMillis() - start_time);
} }
return result; return result;
} }
@ -4245,7 +4246,6 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
} }
} }
nStart = GetTimeMillis();
{ {
WalletRescanReserver reserver(walletInstance.get()); WalletRescanReserver reserver(walletInstance.get());
if (!reserver.reserve() || (ScanResult::SUCCESS != walletInstance->ScanForWalletTransactions(locked_chain->getBlockHash(rescan_height), {} /* stop block */, reserver, true /* update */).status)) { if (!reserver.reserve() || (ScanResult::SUCCESS != walletInstance->ScanForWalletTransactions(locked_chain->getBlockHash(rescan_height), {} /* stop block */, reserver, true /* update */).status)) {
@ -4253,7 +4253,6 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
return nullptr; return nullptr;
} }
} }
walletInstance->WalletLogPrintf("Rescan completed in %15dms\n", GetTimeMillis() - nStart);
walletInstance->ChainStateFlushed(locked_chain->getTipLocator()); walletInstance->ChainStateFlushed(locked_chain->getTipLocator());
walletInstance->database->IncrementUpdateCounter(); walletInstance->database->IncrementUpdateCounter();