progress error message
This commit is contained in:
@@ -165,7 +165,11 @@ void MainWindow::setupTurnstileDialog() {
|
|||||||
auto nextTxBlock = curProgress.nextBlock - Settings::getInstance()->getBlockNumber();
|
auto nextTxBlock = curProgress.nextBlock - Settings::getInstance()->getBlockNumber();
|
||||||
|
|
||||||
if (curProgress.step == curProgress.totalSteps) {
|
if (curProgress.step == curProgress.totalSteps) {
|
||||||
progress.nextTx->setText("Turnstile migration finished");
|
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.";
|
||||||
|
}
|
||||||
|
progress.nextTx->setText(txt);
|
||||||
} else {
|
} else {
|
||||||
progress.nextTx->setText(QString("Next transaction in ")
|
progress.nextTx->setText(QString("Next transaction in ")
|
||||||
% QString::number(nextTxBlock < 0 ? 0 : nextTxBlock)
|
% QString::number(nextTxBlock < 0 ? 0 : nextTxBlock)
|
||||||
|
|||||||
10
src/rpc.cpp
10
src/rpc.cpp
@@ -523,13 +523,9 @@ bool RPC::processUnspent(const json& reply) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
utxos->push_back(
|
utxos->push_back(
|
||||||
UnspentOutput(
|
UnspentOutput{ qsAddr, QString::fromStdString(it["txid"]),
|
||||||
qsAddr,
|
QString::number(it["amount"].get<json::number_float_t>(), 'g', 8),
|
||||||
QString::fromStdString(it["txid"]),
|
(int)confirmations, it["spendable"].get<json::boolean_t>() });
|
||||||
QString::number(it["amount"].get<json::number_float_t>(), 'g', 8),
|
|
||||||
confirmations
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
(*allBalances)[qsAddr] = (*allBalances)[qsAddr] + it["amount"].get<json::number_float_t>();
|
(*allBalances)[qsAddr] = (*allBalances)[qsAddr] + it["amount"].get<json::number_float_t>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -233,7 +233,12 @@ ProgressReport Turnstile::getPlanProgress() {
|
|||||||
|
|
||||||
auto nextBlock = nextStep == plan.end() ? 0 : nextStep->blockNumber;
|
auto nextBlock = nextStep == plan.end() ? 0 : nextStep->blockNumber;
|
||||||
|
|
||||||
return ProgressReport{(int)step*2, total*2, nextBlock};
|
bool hasErrors = std::find_if(plan.begin(), plan.end(), [=] (auto i) {
|
||||||
|
return i.status == TurnstileMigrationItemStatus::NotEnoughBalance ||
|
||||||
|
i.status == TurnstileMigrationItemStatus::UnknownError;
|
||||||
|
}) != plan.end();
|
||||||
|
|
||||||
|
return ProgressReport{(int)step*2, total*2, nextBlock, hasErrors};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Turnstile::executeMigrationStep() {
|
void Turnstile::executeMigrationStep() {
|
||||||
@@ -252,7 +257,7 @@ void Turnstile::executeMigrationStep() {
|
|||||||
auto fnHasUnconfirmed = [=] (QString addr) {
|
auto fnHasUnconfirmed = [=] (QString addr) {
|
||||||
auto utxoset = rpc->getUTXOs();
|
auto utxoset = rpc->getUTXOs();
|
||||||
return std::find_if(utxoset->begin(), utxoset->end(), [=] (auto utxo) {
|
return std::find_if(utxoset->begin(), utxoset->end(), [=] (auto utxo) {
|
||||||
return utxo.address == addr && utxo.confirmations == 0;
|
return utxo.address == addr && utxo.confirmations == 0 && utxo.spendable;
|
||||||
}) != utxoset->end();
|
}) != utxoset->end();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ struct ProgressReport {
|
|||||||
int step;
|
int step;
|
||||||
int totalSteps;
|
int totalSteps;
|
||||||
int nextBlock;
|
int nextBlock;
|
||||||
|
bool hasErrors;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Turnstile
|
class Turnstile
|
||||||
|
|||||||
@@ -1,9 +1 @@
|
|||||||
#include "unspentoutput.h"
|
#include "unspentoutput.h"
|
||||||
|
|
||||||
UnspentOutput::UnspentOutput(QString address, QString txid, QString amount, int confirmations)
|
|
||||||
{
|
|
||||||
this->address = address;
|
|
||||||
this->txid = txid;
|
|
||||||
this->amount = amount;
|
|
||||||
this->confirmations = confirmations;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,15 +3,12 @@
|
|||||||
|
|
||||||
#include "precompiled.h"
|
#include "precompiled.h"
|
||||||
|
|
||||||
class UnspentOutput
|
struct UnspentOutput {
|
||||||
{
|
|
||||||
public:
|
|
||||||
UnspentOutput(QString address, QString txid, QString amount, int confirmations);
|
|
||||||
|
|
||||||
QString address;
|
QString address;
|
||||||
QString txid;
|
QString txid;
|
||||||
QString amount;
|
QString amount;
|
||||||
int confirmations;
|
int confirmations;
|
||||||
|
bool spendable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user