Browse Source

Support fast sync during initial block download

Aditya Kulkarni 5 years ago
parent
commit
74bb8a4e95
  1. 14
      src/connection.cpp
  2. 1
      src/connection.h
  3. 110
      src/createzcashconfdialog.ui
  4. 8
      src/rpc.cpp

14
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<ConnectionConfig> 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<ConnectionConfig> 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<ConnectionConfig>(uiConfig);
}

1
src/connection.h

@ -22,6 +22,7 @@ struct ConnectionConfig {
QString rpcpassword;
bool usingZcashConf;
bool zcashDaemon;
bool skiptxverification;
QString zcashDir;
QString proxy;

110
src/createzcashconfdialog.ui

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>508</width>
<width>596</width>
<height>352</height>
</rect>
</property>
@ -14,46 +14,27 @@
<string>Configure zcash.conf</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="FilledIconLabel" name="lblTopIcon">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">background: #fff;</string>
</property>
<item row="2" column="1">
<widget class="QLabel" name="label">
<property name="text">
<string notr="true"/>
</property>
<property name="scaledContents">
<bool>true</bool>
<string>Your zcash node will be configured for you automatically</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
<item row="3" column="1">
<widget class="QCheckBox" name="chkFastSync">
<property name="text">
<string>Enable Fast Sync</string>
</property>
<property name="centerButtons">
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="6" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="btnAdvancedConfig">
@ -80,17 +61,39 @@
</item>
</layout>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label">
<item row="0" column="1">
<widget class="FilledIconLabel" name="lblTopIcon">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">background: #fff;</string>
</property>
<property name="text">
<string>Your zcash node will be configured for you automatically</string>
<string notr="true"/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="9" column="1">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
<property name="centerButtons">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QGroupBox" name="grpAdvanced">
<property name="title">
<string/>
@ -165,6 +168,39 @@
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_3">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Skips the most expensive checks during the initial block download. &lt;a href=&quot;https://docs.zecwallet.co/using-zecwallet/#fastsync&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Learn More&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>

8
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"));
}

Loading…
Cancel
Save