@@ -615,8 +615,8 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
615615 connect (_clientModel, &ClientModel::numConnectionsChanged, this , &BitcoinGUI::setNumConnections);
616616 connect (_clientModel, &ClientModel::networkActiveChanged, this , &BitcoinGUI::setNetworkActive);
617617
618- modalOverlay->setKnownBestHeight (tip_info->header_height , QDateTime::fromSecsSinceEpoch (tip_info->header_time ));
619- setNumBlocks (tip_info->block_height , QDateTime::fromSecsSinceEpoch (tip_info->block_time ), tip_info->verification_progress , false , SynchronizationState::INIT_DOWNLOAD);
618+ modalOverlay->setKnownBestHeight (tip_info->header_height , QDateTime::fromSecsSinceEpoch (tip_info->header_time ), /* presync= */ false );
619+ setNumBlocks (tip_info->block_height , QDateTime::fromSecsSinceEpoch (tip_info->block_time ), tip_info->verification_progress , SyncType::BLOCK_SYNC , SynchronizationState::INIT_DOWNLOAD);
620620 connect (_clientModel, &ClientModel::numBlocksChanged, this , &BitcoinGUI::setNumBlocks);
621621
622622 // Receive and report messages from client model
@@ -1026,6 +1026,13 @@ void BitcoinGUI::updateHeadersSyncProgressLabel()
10261026 progressBarLabel->setText (tr (" Syncing Headers (%1%)…" ).arg (QString::number (100.0 / (headersTipHeight+estHeadersLeft)*headersTipHeight, ' f' , 1 )));
10271027}
10281028
1029+ void BitcoinGUI::updateHeadersPresyncProgressLabel (int64_t height, const QDateTime& blockDate)
1030+ {
1031+ int estHeadersLeft = blockDate.secsTo (QDateTime::currentDateTime ()) / Params ().GetConsensus ().nPowTargetSpacing ;
1032+ if (estHeadersLeft > HEADER_HEIGHT_DELTA_SYNC)
1033+ progressBarLabel->setText (tr (" Pre-syncing Headers (%1%)…" ).arg (QString::number (100.0 / (height+estHeadersLeft)*height, ' f' , 1 )));
1034+ }
1035+
10291036void BitcoinGUI::openOptionsDialogWithTab (OptionsDialog::Tab tab)
10301037{
10311038 if (!clientModel || !clientModel->getOptionsModel ())
@@ -1039,7 +1046,7 @@ void BitcoinGUI::openOptionsDialogWithTab(OptionsDialog::Tab tab)
10391046 GUIUtil::ShowModalDialogAsynchronously (dlg);
10401047}
10411048
1042- void BitcoinGUI::setNumBlocks (int count, const QDateTime& blockDate, double nVerificationProgress, bool header , SynchronizationState sync_state)
1049+ void BitcoinGUI::setNumBlocks (int count, const QDateTime& blockDate, double nVerificationProgress, SyncType synctype , SynchronizationState sync_state)
10431050{
10441051// Disabling macOS App Nap on initial sync, disk and reindex operations.
10451052#ifdef Q_OS_MACOS
@@ -1052,8 +1059,8 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
10521059
10531060 if (modalOverlay)
10541061 {
1055- if (header )
1056- modalOverlay->setKnownBestHeight (count, blockDate);
1062+ if (synctype != SyncType::BLOCK_SYNC )
1063+ modalOverlay->setKnownBestHeight (count, blockDate, synctype == SyncType::HEADER_PRESYNC );
10571064 else
10581065 modalOverlay->tipUpdate (count, blockDate, nVerificationProgress);
10591066 }
@@ -1067,15 +1074,18 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
10671074 enum BlockSource blockSource = clientModel->getBlockSource ();
10681075 switch (blockSource) {
10691076 case BlockSource::NETWORK:
1070- if (header) {
1077+ if (synctype == SyncType::HEADER_PRESYNC) {
1078+ updateHeadersPresyncProgressLabel (count, blockDate);
1079+ return ;
1080+ } else if (synctype == SyncType::HEADER_SYNC) {
10711081 updateHeadersSyncProgressLabel ();
10721082 return ;
10731083 }
10741084 progressBarLabel->setText (tr (" Synchronizing with network…" ));
10751085 updateHeadersSyncProgressLabel ();
10761086 break ;
10771087 case BlockSource::DISK:
1078- if (header ) {
1088+ if (synctype != SyncType::BLOCK_SYNC ) {
10791089 progressBarLabel->setText (tr (" Indexing blocks on disk…" ));
10801090 } else {
10811091 progressBarLabel->setText (tr (" Processing blocks on disk…" ));
@@ -1085,7 +1095,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
10851095 progressBarLabel->setText (tr (" Reindexing blocks on disk…" ));
10861096 break ;
10871097 case BlockSource::NONE:
1088- if (header ) {
1098+ if (synctype != SyncType::BLOCK_SYNC ) {
10891099 return ;
10901100 }
10911101 progressBarLabel->setText (tr (" Connecting to peers…" ));
0 commit comments