aboutsummaryrefslogtreecommitdiff
path: root/src/txdb.cpp
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2017-06-28 21:05:39 +0200
committerJonas Schnelli <dev@jonasschnelli.ch>2017-06-29 17:48:13 +0200
commit83fbea3f25558fa6c72f2100d203b95b4030573e (patch)
tree19faef41db85a213ae05b06b4e0042934a5e093f /src/txdb.cpp
parent06c5b6edd33213a410d9f128524e74ba076f7ba0 (diff)
Report txdb upgrade not more often then every 10%
Diffstat (limited to 'src/txdb.cpp')
-rw-r--r--src/txdb.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/txdb.cpp b/src/txdb.cpp
index 6eff52f050..c62f51cfce 100644
--- a/src/txdb.cpp
+++ b/src/txdb.cpp
@@ -374,6 +374,7 @@ bool CCoinsViewDB::Upgrade() {
size_t batch_size = 1 << 24;
CDBBatch batch(db);
uiInterface.SetProgressBreakAction(StartShutdown);
+ int reportDone = 0;
while (pcursor->Valid()) {
boost::this_thread::interruption_point();
if (ShutdownRequested()) {
@@ -383,8 +384,13 @@ bool CCoinsViewDB::Upgrade() {
if (pcursor->GetKey(key) && key.first == DB_COINS) {
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));
+ int percentageDone = (int)(high * 100.0 / 65536.0 + 0.5);
+ uiInterface.ShowProgress(_("Upgrading UTXO database") + "\n"+ _("(press q to shutdown and continue later)") + "\n", percentageDone);
+ if (reportDone < percentageDone/10) {
+ // report max. every 10% step
+ LogPrintf("[%d%%]...", percentageDone);
+ reportDone = percentageDone/10;
+ }
}
CCoins old_coins;
if (!pcursor->GetValue(old_coins)) {