Clear turnstile if migration is done while progress box is opened

This commit is contained in:
Aditya Kulkarni 2018-11-01 14:44:51 -07:00
parent 5354b3c1db
commit 9cf3d80dff
1 changed files with 4 additions and 2 deletions

View File

@ -96,7 +96,8 @@ void MainWindow::turnstileProgress() {
QIcon icon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning);
progress.msgIcon->setPixmap(icon.pixmap(64, 64));
auto fnUpdateProgressUI = [=] () {
bool migrationFinished = false;
auto fnUpdateProgressUI = [=, &migrationFinished] () mutable {
// Get the plan progress
if (rpc->getTurnstile()->isMigrationPresent()) {
auto curProgress = rpc->getTurnstile()->getPlanProgress();
@ -110,6 +111,7 @@ void MainWindow::turnstileProgress() {
progress.toAddr->setText(curProgress.to);
if (curProgress.step == curProgress.totalSteps) {
migrationFinished = true;
auto txt = QString("Turnstile migration finished");
if (curProgress.hasErrors) {
txt = txt + ". There were some errors.\n\nYour funds are all in your wallet, so you should be able to finish moving them manually.";
@ -156,7 +158,7 @@ void MainWindow::turnstileProgress() {
});
d.exec();
if (curProgress.step == curProgress.totalSteps) {
if (migrationFinished || curProgress.step == curProgress.totalSteps) {
// Finished, so delete the file
rpc->getTurnstile()->removeFile();
}