Show txdb upgrade progress in debug log

This commit is contained in:
Jonas Schnelli 2017-06-23 09:51:59 +02:00
parent 316fcb5106
commit 06c5b6edd3
No known key found for this signature in database
GPG key ID: 1EB776BB03C7922D

View file

@ -369,7 +369,8 @@ bool CCoinsViewDB::Upgrade() {
}
int64_t count = 0;
LogPrintf("Upgrading database...\n");
LogPrintf("Upgrading utxo-set database...\n");
LogPrintf("[0%%]...");
size_t batch_size = 1 << 24;
CDBBatch batch(db);
uiInterface.SetProgressBreakAction(StartShutdown);
@ -383,6 +384,7 @@ bool CCoinsViewDB::Upgrade() {
if (count++ % 256 == 0) {
uint32_t high = 0x100 * *key.second.begin() + *(key.second.begin() + 1);
uiInterface.ShowProgress(_("Upgrading UTXO database") + "\n"+ _("(press q to shutdown and continue later)") + "\n", (int)(high * 100.0 / 65536.0 + 0.5));
LogPrintf("[%d%%]...", (int)(high * 100.0 / 65536.0 + 0.5));
}
CCoins old_coins;
if (!pcursor->GetValue(old_coins)) {
@ -409,5 +411,6 @@ bool CCoinsViewDB::Upgrade() {
}
db.WriteBatch(batch);
uiInterface.SetProgressBreakAction(std::function<void(void)>());
LogPrintf("[DONE].\n");
return true;
}