aboutsummaryrefslogtreecommitdiff
path: root/src/txdb.cpp
diff options
context:
space:
mode:
authorMatt Corallo <git@bluematt.me>2017-07-07 17:09:55 -0400
committerMatt Corallo <git@bluematt.me>2017-08-20 20:04:15 -0400
commitee4d1493e2a871b26201580c5a990a1df7a5e3f7 (patch)
tree68c3480279fbdfdff0d67dd624efdacfdcacd1d5 /src/txdb.cpp
parent22e301a3d56dc9e6878380ee92c7d19ca43119d2 (diff)
downloadbitcoin-ee4d1493e2a871b26201580c5a990a1df7a5e3f7.tar.xz
Drop upgrade-cancel callback registration for a generic "resumeable"
Instead of passing a StartShutdown reference all the way up from txdb, give ShowProgress a "resumeable" boolean, which is used to inform the user if the action will be resumed, but cancel is always allowed by just calling StartShutdown().
Diffstat (limited to 'src/txdb.cpp')
-rw-r--r--src/txdb.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/txdb.cpp b/src/txdb.cpp
index 4c1b04cd94..bbad3899ea 100644
--- a/src/txdb.cpp
+++ b/src/txdb.cpp
@@ -371,9 +371,9 @@ bool CCoinsViewDB::Upgrade() {
int64_t count = 0;
LogPrintf("Upgrading utxo-set database...\n");
LogPrintf("[0%%]...");
+ uiInterface.ShowProgress(_("Upgrading UTXO database"), 0, true);
size_t batch_size = 1 << 24;
CDBBatch batch(db);
- uiInterface.SetProgressBreakAction(StartShutdown);
int reportDone = 0;
std::pair<unsigned char, uint256> key;
std::pair<unsigned char, uint256> prev_key = {DB_COINS, uint256()};
@@ -386,7 +386,7 @@ bool CCoinsViewDB::Upgrade() {
if (count++ % 256 == 0) {
uint32_t high = 0x100 * *key.second.begin() + *(key.second.begin() + 1);
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);
+ uiInterface.ShowProgress(_("Upgrading UTXO database"), percentageDone, true);
if (reportDone < percentageDone/10) {
// report max. every 10% step
LogPrintf("[%d%%]...", percentageDone);
@@ -420,7 +420,7 @@ bool CCoinsViewDB::Upgrade() {
}
db.WriteBatch(batch);
db.CompactRange({DB_COINS, uint256()}, key);
- uiInterface.SetProgressBreakAction(std::function<void(void)>());
+ uiInterface.ShowProgress("", 100, false);
LogPrintf("[%s].\n", ShutdownRequested() ? "CANCELLED" : "DONE");
return !ShutdownRequested();
}