aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2017-06-23 09:33:31 +0200
committerJonas Schnelli <dev@jonasschnelli.ch>2017-06-29 17:48:11 +0200
commitae09d4583b26251e67fa48216ebafb6bcdf2472b (patch)
treee21d6a89dee9ed86302240201eec4a1e41ffda8d /src
parent00cb69bc8655b1c17064a7e42453fd049e555076 (diff)
Allow to shut down during txdb upgrade
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp5
-rw-r--r--src/txdb.cpp3
2 files changed, 6 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp
index d59713258c..ec1f18faef 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1358,7 +1358,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
LogPrintf("* Using %.1fMiB for in-memory UTXO set (plus up to %.1fMiB of unused mempool space)\n", nCoinCacheUsage * (1.0 / 1024 / 1024), nMempoolSizeMax * (1.0 / 1024 / 1024));
bool fLoaded = false;
- while (!fLoaded) {
+ while (!fLoaded && !fRequestShutdown) {
bool fReset = fReindex;
std::string strLoadError;
@@ -1389,6 +1389,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
break;
}
}
+ if (fRequestShutdown) break;
if (!LoadBlockIndex(chainparams)) {
strLoadError = _("Error loading block database");
@@ -1466,7 +1467,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
fLoaded = true;
} while(false);
- if (!fLoaded) {
+ if (!fLoaded && !fRequestShutdown) {
// first suggest a reindex
if (!fReset) {
bool fRet = uiInterface.ThreadSafeQuestion(
diff --git a/src/txdb.cpp b/src/txdb.cpp
index d24162ba2d..3e05683d1e 100644
--- a/src/txdb.cpp
+++ b/src/txdb.cpp
@@ -371,6 +371,9 @@ bool CCoinsViewDB::Upgrade() {
CDBBatch batch(db);
while (pcursor->Valid()) {
boost::this_thread::interruption_point();
+ if (ShutdownRequested()) {
+ break;
+ }
std::pair<unsigned char, uint256> key;
if (pcursor->GetKey(key) && key.first == DB_COINS) {
CCoins old_coins;