Skip to content

Commit

Permalink
Show if syncing in zcashd
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapk00 committed Nov 12, 2018
1 parent b98aaac commit acea95a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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">
Expand Down
22 changes: 13 additions & 9 deletions src/rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
Expand All @@ -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
Expand Down

0 comments on commit acea95a

Please sign in to comment.