Download params before creating zcash.conf

This commit is contained in:
Aditya Kulkarni
2018-11-07 21:40:57 -08:00
parent d2c103f032
commit b2fa525987

View File

@@ -74,8 +74,9 @@ void ConnectionLoader::loadConnection() {
* This will create a new zcash.conf, download zcash parameters. * This will create a new zcash.conf, download zcash parameters.
*/ */
void ConnectionLoader::createZcashConf() { void ConnectionLoader::createZcashConf() {
// Create zcash.conf // Fetch params. After params are fetched, create the zcash.conf file and
{ // try loading the connection again
downloadParams([=] () {
auto confLocation = zcashConfWritableLocation(); auto confLocation = zcashConfWritableLocation();
qDebug() << "Creating file " << confLocation; qDebug() << "Creating file " << confLocation;
@@ -94,10 +95,9 @@ void ConnectionLoader::createZcashConf() {
out << "rpcuser=zec-qt-wallet\n"; out << "rpcuser=zec-qt-wallet\n";
out << "rpcpassword=" % QString::number(std::rand()) << "\n"; out << "rpcpassword=" % QString::number(std::rand()) << "\n";
file.close(); file.close();
}
// Fetch params. After params are fetched, try loading the connection again this->loadConnection();
downloadParams([=] () { this->loadConnection(); }); });
} }
void ConnectionLoader::downloadParams(std::function<void(void)> cb) { void ConnectionLoader::downloadParams(std::function<void(void)> cb) {