zcashd on windows
This commit is contained in:
@@ -70,6 +70,23 @@ void ConnectionLoader::loadConnection() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString randomPassword() {
|
||||||
|
static const char alphanum[] =
|
||||||
|
"0123456789"
|
||||||
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
"abcdefghijklmnopqrstuvwxyz";
|
||||||
|
|
||||||
|
const int passwordLength = 10;
|
||||||
|
char* s = new char[passwordLength + 1];
|
||||||
|
|
||||||
|
for (int i = 0; i < passwordLength; ++i) {
|
||||||
|
s[i] = alphanum[rand() % (sizeof(alphanum) - 1)];
|
||||||
|
}
|
||||||
|
|
||||||
|
s[passwordLength] = 0;
|
||||||
|
return QString::fromStdString(s);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will create a new zcash.conf, download zcash parameters.
|
* This will create a new zcash.conf, download zcash parameters.
|
||||||
*/
|
*/
|
||||||
@@ -93,13 +110,14 @@ void ConnectionLoader::createZcashConf() {
|
|||||||
|
|
||||||
out << "server=1\n";
|
out << "server=1\n";
|
||||||
out << "rpcuser=zec-qt-wallet\n";
|
out << "rpcuser=zec-qt-wallet\n";
|
||||||
out << "rpcpassword=" % QString::number(std::rand()) << "\n";
|
out << "rpcpassword=" % randomPassword() << "\n";
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
this->loadConnection();
|
this->loadConnection();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ConnectionLoader::downloadParams(std::function<void(void)> cb) {
|
void ConnectionLoader::downloadParams(std::function<void(void)> cb) {
|
||||||
// Add all the files to the download queue
|
// Add all the files to the download queue
|
||||||
downloadQueue = new QQueue<QUrl>();
|
downloadQueue = new QQueue<QUrl>();
|
||||||
@@ -216,20 +234,19 @@ bool ConnectionLoader::startEmbeddedZcashd() {
|
|||||||
qDebug() << "Starting zcashd";
|
qDebug() << "Starting zcashd";
|
||||||
QFileInfo fi(Settings::getInstance()->getExecName());
|
QFileInfo fi(Settings::getInstance()->getExecName());
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
auto zcashdProgram = "zcashd";
|
auto zcashdProgram = fi.dir().absoluteFilePath("zcashd");
|
||||||
#elif defined(Q_OS_DARWIN)
|
#elif defined(Q_OS_DARWIN)
|
||||||
auto zcashdProgram = "zcashd";
|
auto zcashdProgram = fi.dir().absoluteFilePath("zcashd");
|
||||||
#else
|
#else
|
||||||
auto zcashdProgram = "zcashd.exe";
|
auto zcashdProgram = fi.dir().absoluteFilePath("zcashd.exe");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!QFile(zcashdProgram).exists()) {
|
if (!QFile(zcashdProgram).exists()) {
|
||||||
qDebug() << "Can't find zcashd";
|
qDebug() << "Can't find zcashd at " << zcashdProgram;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ezcashd = new QProcess(main);
|
ezcashd = new QProcess(main);
|
||||||
ezcashd->setWorkingDirectory(fi.dir().absolutePath());
|
|
||||||
QObject::connect(ezcashd, &QProcess::started, [=] () {
|
QObject::connect(ezcashd, &QProcess::started, [=] () {
|
||||||
qDebug() << "zcashd started";
|
qDebug() << "zcashd started";
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="status">
|
<widget class="QLabel" name="status">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Connection Status</string>
|
<string>Starting Up</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
|
|||||||
Reference in New Issue
Block a user