Browse Source

Show txdb upgrade progress in debug log

0.15
Jonas Schnelli 8 years ago
parent
commit
06c5b6edd3
No known key found for this signature in database
GPG Key ID: 1EB776BB03C7922D
  1. 5
      src/txdb.cpp

5
src/txdb.cpp

@ -369,7 +369,8 @@ bool CCoinsViewDB::Upgrade() {
} }
int64_t count = 0; int64_t count = 0;
LogPrintf("Upgrading database...\n"); LogPrintf("Upgrading utxo-set database...\n");
LogPrintf("[0%%]...");
size_t batch_size = 1 << 24; size_t batch_size = 1 << 24;
CDBBatch batch(db); CDBBatch batch(db);
uiInterface.SetProgressBreakAction(StartShutdown); uiInterface.SetProgressBreakAction(StartShutdown);
@ -383,6 +384,7 @@ bool CCoinsViewDB::Upgrade() {
if (count++ % 256 == 0) { if (count++ % 256 == 0) {
uint32_t high = 0x100 * *key.second.begin() + *(key.second.begin() + 1); 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)); 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; CCoins old_coins;
if (!pcursor->GetValue(old_coins)) { if (!pcursor->GetValue(old_coins)) {
@ -409,5 +411,6 @@ bool CCoinsViewDB::Upgrade() {
} }
db.WriteBatch(batch); db.WriteBatch(batch);
uiInterface.SetProgressBreakAction(std::function<void(void)>()); uiInterface.SetProgressBreakAction(std::function<void(void)>());
LogPrintf("[DONE].\n");
return true; return true;
} }

Loading…
Cancel
Save