diff --git a/src/connection.cpp b/src/connection.cpp index 9c9f2e3..2b5ae81 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -185,9 +185,18 @@ void ConnectionLoader::createZcashConf() { out << "addnode=mainnet.z.cash\n"; out << "rpcuser=zec-qt-wallet\n"; out << "rpcpassword=" % randomPassword() << "\n"; + + // Fast sync override + if (ui.chkFastSync->isChecked()) { + out << "ibdskiptxverification=1\n"; + } + + // Datadir override if (!datadir.isEmpty()) { out << "datadir=" % datadir % "\n"; } + + // Tor override if (useTor) { out << "proxy=127.0.0.1:9050\n"; } @@ -623,6 +632,9 @@ std::shared_ptr ConnectionLoader::autoDetectZcashConf() { zcashconf->port.isEmpty()) { zcashconf->port = "18232"; } + if (name == "ibdskiptxverification" && value == "1") { + zcashconf->skiptxverification = true; + } } // If rpcport is not in the file, and it was not set by the testnet=1 flag, then go to default @@ -649,7 +661,7 @@ std::shared_ptr ConnectionLoader::loadFromSettings() { if (username.isEmpty() || password.isEmpty()) return nullptr; - auto uiConfig = new ConnectionConfig{ host, port, username, password, false, false, "", "", ConnectionType::UISettingsZCashD}; + auto uiConfig = new ConnectionConfig{ host, port, username, password, false, false, false, "", "", ConnectionType::UISettingsZCashD}; return std::shared_ptr(uiConfig); } diff --git a/src/connection.h b/src/connection.h index 590ba2e..d01f76f 100644 --- a/src/connection.h +++ b/src/connection.h @@ -22,6 +22,7 @@ struct ConnectionConfig { QString rpcpassword; bool usingZcashConf; bool zcashDaemon; + bool skiptxverification; QString zcashDir; QString proxy; diff --git a/src/createzcashconfdialog.ui b/src/createzcashconfdialog.ui index a8c5d50..a5b45e6 100644 --- a/src/createzcashconfdialog.ui +++ b/src/createzcashconfdialog.ui @@ -6,7 +6,7 @@ 0 0 - 508 + 596 352 @@ -14,46 +14,27 @@ Configure zcash.conf - - - - - 0 - 0 - - - - background: #fff; - + + - - - - true + Your zcash node will be configured for you automatically - - - - - - Qt::Horizontal + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - Qt::Horizontal - - - QDialogButtonBox::Ok + + + + Enable Fast Sync - + true - + @@ -80,17 +61,39 @@ - - + + + + + 0 + 0 + + + + background: #fff; + - Your zcash node will be configured for you automatically + - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + true - + + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + true + + + + @@ -165,6 +168,39 @@ + + + + Qt::Horizontal + + + + + + + <html><head/><body><p>Skips the most expensive checks during the initial block download. <a href="https://docs.zecwallet.co/using-zecwallet/#fastsync"><span style=" text-decoration: underline; color:#0000ff;">Learn More</span></a></p></body></html> + + + Qt::RichText + + + true + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse + + + + + + + Qt::Horizontal + + + diff --git a/src/rpc.cpp b/src/rpc.cpp index 8e2ba37..825f506 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -635,6 +635,14 @@ void RPC::getInfoThenRefresh(bool force) { ui->blockheight->setText(txt); ui->heightLabel->setText(QObject::tr("Downloading blocks")); } else { + // If syncing is finished, we may have to remove the ibdskiptxverification + // flag from zcash.conf + if (getConnection() != nullptr && getConnection()->config->skiptxverification) { + getConnection()->config->skiptxverification = false; + Settings::removeFromZcashConf(Settings::getInstance()->getZcashdConfLocation(), + "ibdskiptxverification"); + } + ui->blockheight->setText(QString::number(blockNumber)); ui->heightLabel->setText(QObject::tr("Block height")); }