Show estimated blocks while syncing properly
This commit is contained in:
@@ -39,7 +39,7 @@ void ConnectionLoader::doAutoConnect() {
|
|||||||
refreshZcashdState(connection, [=] () {
|
refreshZcashdState(connection, [=] () {
|
||||||
// Refused connection. So try and start embedded zcashd
|
// Refused connection. So try and start embedded zcashd
|
||||||
if (Settings::getInstance()->useEmbedded()) {
|
if (Settings::getInstance()->useEmbedded()) {
|
||||||
this->showInformation("Starting Embedded zcashd");
|
this->showInformation("Starting embedded zcashd");
|
||||||
if (this->startEmbeddedZcashd()) {
|
if (this->startEmbeddedZcashd()) {
|
||||||
// Embedded zcashd started up. Wait a second and then refresh the connection
|
// Embedded zcashd started up. Wait a second and then refresh the connection
|
||||||
QTimer::singleShot(1000, [=]() { doAutoConnect(); } );
|
QTimer::singleShot(1000, [=]() { doAutoConnect(); } );
|
||||||
|
|||||||
16
src/rpc.cpp
16
src/rpc.cpp
@@ -543,6 +543,11 @@ void RPC::getInfoThenRefresh(bool force) {
|
|||||||
bool isSyncing = progress < 0.995; // 99.59%
|
bool isSyncing = progress < 0.995; // 99.59%
|
||||||
int blockNumber = reply["blocks"].get<json::number_unsigned_t>();
|
int blockNumber = reply["blocks"].get<json::number_unsigned_t>();
|
||||||
|
|
||||||
|
int estimatedheight = 0;
|
||||||
|
if (reply.find("estimatedheight") != reply.end()) {
|
||||||
|
estimatedheight = reply["estimatedheight"].get<json::number_unsigned_t>();
|
||||||
|
}
|
||||||
|
|
||||||
Settings::getInstance()->setSyncing(isSyncing);
|
Settings::getInstance()->setSyncing(isSyncing);
|
||||||
Settings::getInstance()->setBlockNumber(blockNumber);
|
Settings::getInstance()->setBlockNumber(blockNumber);
|
||||||
|
|
||||||
@@ -550,11 +555,12 @@ void RPC::getInfoThenRefresh(bool force) {
|
|||||||
if (ezcashd) {
|
if (ezcashd) {
|
||||||
if (isSyncing) {
|
if (isSyncing) {
|
||||||
const qint64 genisisTimeMSec = 1477638000000;
|
const qint64 genisisTimeMSec = 1477638000000;
|
||||||
qint64 estBlocks = (QDateTime::currentMSecsSinceEpoch() - genisisTimeMSec) / 2.5 / 60 / 1000;
|
QString txt = QString::number(blockNumber);
|
||||||
// Round to nearest 10
|
if (estimatedheight > 0) {
|
||||||
estBlocks = ((estBlocks + 5) / 10) * 10;
|
txt = txt % " / ~" % QString::number(estimatedheight);
|
||||||
ui->blockheight->setText(QString::number(blockNumber) % /*" / ~" % QString::number(estBlocks) % */
|
}
|
||||||
" ( " % QString::number(progress * 100, 'f', 0) % "% )");
|
txt = txt % " ( " % QString::number(progress * 100, 'f', 0) % "% )";
|
||||||
|
ui->blockheight->setText(txt);
|
||||||
ui->heightLabel->setText("Downloading blocks");
|
ui->heightLabel->setText("Downloading blocks");
|
||||||
} else {
|
} else {
|
||||||
ui->blockheight->setText(QString::number(blockNumber));
|
ui->blockheight->setText(QString::number(blockNumber));
|
||||||
|
|||||||
Reference in New Issue
Block a user