Browse Source

Show if syncing in zcashd

import_zecw
Aditya Kulkarni 6 years ago
parent
commit
acea95a183
  1. 10
      src/mainwindow.ui
  2. 22
      src/rpc.cpp

10
src/mainwindow.ui

@ -22,7 +22,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>4</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
@ -316,8 +316,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>928</width> <width>920</width>
<height>382</height> <height>334</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="sendToLayout"> <layout class="QVBoxLayout" name="sendToLayout">
@ -772,7 +772,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="heightLabel">
<property name="text"> <property name="text">
<string>Block height</string> <string>Block height</string>
</property> </property>
@ -864,7 +864,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>968</width> <width>968</width>
<height>19</height> <height>22</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">

22
src/rpc.cpp

@ -526,7 +526,6 @@ void RPC::getInfoThenRefresh(bool force) {
conn->doRPCIgnoreError(payload, [=](const json& reply) { conn->doRPCIgnoreError(payload, [=](const json& reply) {
qint64 solrate = reply.get<json::number_unsigned_t>(); qint64 solrate = reply.get<json::number_unsigned_t>();
ui->blockheight->setText(QString::number(curBlock));
ui->numconnections->setText(QString::number(conns)); ui->numconnections->setText(QString::number(conns));
ui->solrate->setText(QString::number(solrate) % " Sol/s"); ui->solrate->setText(QString::number(solrate) % " Sol/s");
}); });
@ -548,14 +547,19 @@ void RPC::getInfoThenRefresh(bool force) {
Settings::getInstance()->setBlockNumber(blockNumber); Settings::getInstance()->setBlockNumber(blockNumber);
// Update zcashd tab if it exists // Update zcashd tab if it exists
if (ezcashd && isSyncing) { if (ezcashd) {
// 895 / ~426530 (0 % ) if (isSyncing) {
const qint64 genisisTimeMSec = 1477638000000; const qint64 genisisTimeMSec = 1477638000000;
qint64 estBlocks = (QDateTime::currentMSecsSinceEpoch() - genisisTimeMSec) / 2.5 / 60 / 1000; qint64 estBlocks = (QDateTime::currentMSecsSinceEpoch() - genisisTimeMSec) / 2.5 / 60 / 1000;
// Round to nearest 10 // Round to nearest 10
estBlocks = ((estBlocks + 5) / 10) * 10; estBlocks = ((estBlocks + 5) / 10) * 10;
ui->blockheight->setText(ui->blockheight->text() % /*" / ~" % QString::number(estBlocks) % */ ui->blockheight->setText(QString::number(blockNumber) % /*" / ~" % QString::number(estBlocks) % */
" ( " % QString::number(progress * 100, 'f', 0) % "% )"); " ( " % QString::number(progress * 100, 'f', 0) % "% )");
ui->heightLabel->setText("Downloading blocks");
} else {
ui->blockheight->setText(QString::number(blockNumber));
ui->heightLabel->setText("Block height");
}
} }
// Update the status bar // Update the status bar

Loading…
Cancel
Save