mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-26 06:44:32 +00:00
Report txdb upgrade not more often then every 10%
This commit is contained in:
parent
06c5b6edd3
commit
83fbea3f25
10
src/txdb.cpp
10
src/txdb.cpp
@ -374,6 +374,7 @@ bool CCoinsViewDB::Upgrade() {
|
|||||||
size_t batch_size = 1 << 24;
|
size_t batch_size = 1 << 24;
|
||||||
CDBBatch batch(db);
|
CDBBatch batch(db);
|
||||||
uiInterface.SetProgressBreakAction(StartShutdown);
|
uiInterface.SetProgressBreakAction(StartShutdown);
|
||||||
|
int reportDone = 0;
|
||||||
while (pcursor->Valid()) {
|
while (pcursor->Valid()) {
|
||||||
boost::this_thread::interruption_point();
|
boost::this_thread::interruption_point();
|
||||||
if (ShutdownRequested()) {
|
if (ShutdownRequested()) {
|
||||||
@ -383,8 +384,13 @@ bool CCoinsViewDB::Upgrade() {
|
|||||||
if (pcursor->GetKey(key) && key.first == DB_COINS) {
|
if (pcursor->GetKey(key) && key.first == DB_COINS) {
|
||||||
if (count++ % 256 == 0) {
|
if (count++ % 256 == 0) {
|
||||||
uint32_t high = 0x100 * *key.second.begin() + *(key.second.begin() + 1);
|
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));
|
int percentageDone = (int)(high * 100.0 / 65536.0 + 0.5);
|
||||||
LogPrintf("[%d%%]...", (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;
|
CCoins old_coins;
|
||||||
if (!pcursor->GetValue(old_coins)) {
|
if (!pcursor->GetValue(old_coins)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user