mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 20:32:35 -03:00
Qt: Fix update headers-count
This commit is contained in:
parent
7bb45e4b7a
commit
e8db6b8044
2 changed files with 8 additions and 1 deletions
|
@ -71,6 +71,7 @@ void ModalOverlay::setKnownBestHeight(int count, const QDateTime& blockDate)
|
||||||
if (count > bestHeaderHeight) {
|
if (count > bestHeaderHeight) {
|
||||||
bestHeaderHeight = count;
|
bestHeaderHeight = count;
|
||||||
bestHeaderDate = blockDate;
|
bestHeaderDate = blockDate;
|
||||||
|
UpdateHeaderSyncLabel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,11 +137,16 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri
|
||||||
if (estimateNumHeadersLeft < HEADER_HEIGHT_DELTA_SYNC && hasBestHeader) {
|
if (estimateNumHeadersLeft < HEADER_HEIGHT_DELTA_SYNC && hasBestHeader) {
|
||||||
ui->numberOfBlocksLeft->setText(QString::number(bestHeaderHeight - count));
|
ui->numberOfBlocksLeft->setText(QString::number(bestHeaderHeight - count));
|
||||||
} else {
|
} else {
|
||||||
ui->numberOfBlocksLeft->setText(tr("Unknown. Syncing Headers (%1)...").arg(bestHeaderHeight));
|
UpdateHeaderSyncLabel();
|
||||||
ui->expectedTimeLeft->setText(tr("Unknown..."));
|
ui->expectedTimeLeft->setText(tr("Unknown..."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModalOverlay::UpdateHeaderSyncLabel() {
|
||||||
|
int est_headers_left = bestHeaderDate.secsTo(QDateTime::currentDateTime()) / Params().GetConsensus().nPowTargetSpacing;
|
||||||
|
ui->numberOfBlocksLeft->setText(tr("Unknown. Syncing Headers (%1, %2%)...").arg(bestHeaderHeight).arg(QString::number(100.0 / (bestHeaderHeight + est_headers_left) * bestHeaderHeight, 'f', 1)));
|
||||||
|
}
|
||||||
|
|
||||||
void ModalOverlay::toggleVisibility()
|
void ModalOverlay::toggleVisibility()
|
||||||
{
|
{
|
||||||
showHide(layerIsVisible, true);
|
showHide(layerIsVisible, true);
|
||||||
|
|
|
@ -45,6 +45,7 @@ private:
|
||||||
QVector<QPair<qint64, double> > blockProcessTime;
|
QVector<QPair<qint64, double> > blockProcessTime;
|
||||||
bool layerIsVisible;
|
bool layerIsVisible;
|
||||||
bool userClosed;
|
bool userClosed;
|
||||||
|
void UpdateHeaderSyncLabel();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BITCOIN_QT_MODALOVERLAY_H
|
#endif // BITCOIN_QT_MODALOVERLAY_H
|
||||||
|
|
Loading…
Reference in a new issue