Browse Source

Allow to shut down during txdb upgrade

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

5
src/init.cpp

@ -1358,7 +1358,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) @@ -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) @@ -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) @@ -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(

3
src/txdb.cpp

@ -371,6 +371,9 @@ bool CCoinsViewDB::Upgrade() { @@ -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;

Loading…
Cancel
Save