File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 11
11
#include " pow.h"
12
12
#include " uint256.h"
13
13
#include " util.h"
14
+ #include " ui_interface.h"
15
+ #include " init.h"
14
16
15
17
#include < stdint.h>
16
18
@@ -366,16 +368,22 @@ bool CCoinsViewDB::Upgrade() {
366
368
return true ;
367
369
}
368
370
371
+ int64_t count = 0 ;
369
372
LogPrintf (" Upgrading database...\n " );
370
373
size_t batch_size = 1 << 24 ;
371
374
CDBBatch batch (db);
375
+ uiInterface.SetProgressBreakAction (StartShutdown);
372
376
while (pcursor->Valid ()) {
373
377
boost::this_thread::interruption_point ();
374
378
if (ShutdownRequested ()) {
375
379
break ;
376
380
}
377
381
std::pair<unsigned char , uint256> key;
378
382
if (pcursor->GetKey (key) && key.first == DB_COINS) {
383
+ if (count++ % 256 == 0 ) {
384
+ uint32_t high = 0x100 * *key.second .begin () + *(key.second .begin () + 1 );
385
+ uiInterface.ShowProgress (_ (" Upgrading UTXO database" ) + " \n " + _ (" (press q to shutdown and continue later)" ) + " \n " , (int )(high * 100.0 / 65536.0 + 0.5 ));
386
+ }
379
387
CCoins old_coins;
380
388
if (!pcursor->GetValue (old_coins)) {
381
389
return error (" %s: cannot parse CCoins record" , __func__);
@@ -400,5 +408,6 @@ bool CCoinsViewDB::Upgrade() {
400
408
}
401
409
}
402
410
db.WriteBatch (batch);
411
+ uiInterface.SetProgressBreakAction (std::function<void (void )>());
403
412
return true ;
404
413
}
You can’t perform that action at this time.
0 commit comments