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

22
src/rpc.cpp

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

Loading…
Cancel
Save