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