mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-24 05:24:34 +00:00
Added ability to respond to signals during Block Loading stage.
This commit is contained in:
parent
ac4161e25d
commit
871c3557bf
@ -529,7 +529,7 @@ bool CTxDB::LoadBlockIndex()
|
|||||||
// Unserialize
|
// Unserialize
|
||||||
string strType;
|
string strType;
|
||||||
ssKey >> strType;
|
ssKey >> strType;
|
||||||
if (strType == "blockindex")
|
if (strType == "blockindex" && !fRequestShutdown)
|
||||||
{
|
{
|
||||||
CDiskBlockIndex diskindex;
|
CDiskBlockIndex diskindex;
|
||||||
ssValue >> diskindex;
|
ssValue >> diskindex;
|
||||||
@ -556,11 +556,14 @@ bool CTxDB::LoadBlockIndex()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
break;
|
break; // if shutdown requested or finished loading block index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pcursor->close();
|
pcursor->close();
|
||||||
|
|
||||||
|
if (fRequestShutdown)
|
||||||
|
return true;
|
||||||
|
|
||||||
// Calculate bnChainWork
|
// Calculate bnChainWork
|
||||||
vector<pair<int, CBlockIndex*> > vSortedByHeight;
|
vector<pair<int, CBlockIndex*> > vSortedByHeight;
|
||||||
vSortedByHeight.reserve(mapBlockIndex.size());
|
vSortedByHeight.reserve(mapBlockIndex.size());
|
||||||
|
@ -353,6 +353,15 @@ bool AppInit2(int argc, char* argv[])
|
|||||||
nStart = GetTimeMillis();
|
nStart = GetTimeMillis();
|
||||||
if (!LoadBlockIndex())
|
if (!LoadBlockIndex())
|
||||||
strErrors << _("Error loading blkindex.dat") << "\n";
|
strErrors << _("Error loading blkindex.dat") << "\n";
|
||||||
|
|
||||||
|
// as LoadBlockIndex can take several minutes, it's possible the user
|
||||||
|
// requested to kill bitcoin-qt during the last operation. If so, exit.
|
||||||
|
// As the program has not fully started yet, Shutdown() is possibly overkill.
|
||||||
|
if (fRequestShutdown)
|
||||||
|
{
|
||||||
|
printf("Shutdown requested. Exiting.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
||||||
|
|
||||||
InitMessage(_("Loading wallet..."));
|
InitMessage(_("Loading wallet..."));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user