Browse Source

Add callbacks properly

pull/45/head
Aditya Kulkarni 5 years ago
parent
commit
97461c373b
  1. 7
      src/turnstile.cpp

7
src/turnstile.cpp

@ -320,8 +320,10 @@ void Turnstile::executeMigrationStep() {
return; return;
} }
// Sometimes, we check too quickly, and the unspent UTXO is not updated yet, so we'll
// double check to see if there is enough balance.
if (!rpc->getAllBalances()->keys().contains(nextStep->intTAddr)) { if (!rpc->getAllBalances()->keys().contains(nextStep->intTAddr)) {
qDebug() << QString("The intermediate t-address doesn't have balance, even though it is confirmed"); //qDebug() << QString("The intermediate t-address doesn't have balance, even though it seems to be confirmed");
return; return;
} }
@ -350,12 +352,13 @@ void Turnstile::executeMigrationStep() {
} }
} }
void Turnstile::doSendTx(Tx tx, std::function<void(void)> /*cb*/) { void Turnstile::doSendTx(Tx tx, std::function<void(void)> cb) {
rpc->executeTransaction(tx, [=] (QString opid) { rpc->executeTransaction(tx, [=] (QString opid) {
mainwindow->ui->statusBar->showMessage(QObject::tr("Computing Tx: ") % opid); mainwindow->ui->statusBar->showMessage(QObject::tr("Computing Tx: ") % opid);
}, },
[=] (QString /*opid*/, QString txid) { [=] (QString /*opid*/, QString txid) {
mainwindow->ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid); mainwindow->ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid);
cb();
}, },
[=] (QString opid, QString errStr) { [=] (QString opid, QString errStr) {
mainwindow->ui->statusBar->showMessage(QObject::tr(" Tx ") % opid % QObject::tr(" failed"), 15 * 1000); mainwindow->ui->statusBar->showMessage(QObject::tr(" Tx ") % opid % QObject::tr(" failed"), 15 * 1000);

Loading…
Cancel
Save