Try another server if current is down when restoring during a rescan; report down server in error
This commit is contained in:
@@ -214,22 +214,24 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
char* resp = litelib_initialize_new_from_phrase(config->dangerous, config->server.toStdString().c_str(),
|
||||
seed.toStdString().c_str(), birthday, number);
|
||||
reply = litelib_process_response(resp);
|
||||
|
||||
if (reply.toUpper().trimmed() != "OK") {
|
||||
QMessageBox::warning(this, tr("Failed to restore wallet"),
|
||||
tr("Couldn't restore the wallet") + "\n" + reply,
|
||||
QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
//TODO: try another server with getRandomServer()
|
||||
qDebug() << __func__ << ": caught an exception! Bailing out: " << e.what();
|
||||
qDebug() << __func__ << ": caught an exception, ignoring: " << e.what();
|
||||
}
|
||||
if (reply.toUpper().trimmed() != "OK") {
|
||||
qDebug() << "Lite server " << config->server << " is down, getting a random one";
|
||||
config->server = Settings::getRandomServer();
|
||||
qDebug() << __func__ << ": new server is " << config->server;
|
||||
// retry with the new server
|
||||
char* resp = litelib_initialize_new(config->dangerous,config->server.toStdString().c_str());
|
||||
reply = litelib_process_response(resp);
|
||||
}
|
||||
|
||||
if (reply.toUpper().trimmed() != "OK") {
|
||||
QMessageBox::warning(this, tr("Failed to restore wallet"),
|
||||
tr("Couldn't restore the wallet") + "\n" + reply,
|
||||
tr("Couldn't restore the wallet") + "\n" + "server=" + config->server "\n" + reply,
|
||||
QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 4. Finally attempt to save the wallet
|
||||
|
||||
Reference in New Issue
Block a user