Skip to content

Commit

Permalink
Show txdb upgrade progress in debug log
Browse files Browse the repository at this point in the history
Cherry-picked from: 06c5b6e
  • Loading branch information
jonasschnelli authored and xanimo committed Dec 19, 2024
1 parent a2cfd00 commit deb2a9f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/txdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,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);
Expand All @@ -391,6 +392,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)) {
Expand All @@ -417,5 +419,6 @@ bool CCoinsViewDB::Upgrade() {
}
db.WriteBatch(batch);
uiInterface.SetProgressBreakAction(std::function<void(void)>());
LogPrintf("[DONE].\n");
return true;
}

0 comments on commit deb2a9f

Please sign in to comment.