|
41 | 41 | #include <qt/masternodelist.h>
|
42 | 42 | #include <util/system.h>
|
43 | 43 | #include <util/translation.h>
|
| 44 | +#include <validation.h> |
44 | 45 |
|
45 | 46 | #include <QAction>
|
46 | 47 | #include <QApplication>
|
@@ -809,7 +810,7 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
|
809 | 810 | connect(_clientModel, &ClientModel::networkActiveChanged, this, &BitcoinGUI::setNetworkActive);
|
810 | 811 |
|
811 | 812 | modalOverlay->setKnownBestHeight(tip_info->header_height, QDateTime::fromTime_t(tip_info->header_time));
|
812 |
| - setNumBlocks(tip_info->block_height, QDateTime::fromTime_t(tip_info->block_time), QString::fromStdString(tip_info->block_hash.ToString()), tip_info->verification_progress, false); |
| 813 | + setNumBlocks(tip_info->block_height, QDateTime::fromTime_t(tip_info->block_time), QString::fromStdString(tip_info->block_hash.ToString()), tip_info->verification_progress, false, SynchronizationState::INIT_DOWNLOAD); |
813 | 814 | connect(_clientModel, &ClientModel::numBlocksChanged, this, &BitcoinGUI::setNumBlocks);
|
814 | 815 |
|
815 | 816 | connect(_clientModel, &ClientModel::additionalDataSyncProgressChanged, this, &BitcoinGUI::setAdditionalDataSyncProgress);
|
@@ -1254,7 +1255,7 @@ void BitcoinGUI::updateNetworkState()
|
1254 | 1255 | }
|
1255 | 1256 |
|
1256 | 1257 | if (fNetworkBecameActive || fNetworkBecameInactive) {
|
1257 |
| - setNumBlocks(m_node.getNumBlocks(), QDateTime::fromTime_t(m_node.getLastBlockTime()), QString::fromStdString(m_node.getLastBlockHash()), m_node.getVerificationProgress(), false); |
| 1258 | + setNumBlocks(m_node.getNumBlocks(), QDateTime::fromTime_t(m_node.getLastBlockTime()), QString::fromStdString(m_node.getLastBlockHash()), m_node.getVerificationProgress(), false, SynchronizationState::INIT_DOWNLOAD); |
1258 | 1259 | }
|
1259 | 1260 |
|
1260 | 1261 | nCountPrev = count;
|
@@ -1372,11 +1373,11 @@ void BitcoinGUI::updateWidth()
|
1372 | 1373 | resize(nWidth, height());
|
1373 | 1374 | }
|
1374 | 1375 |
|
1375 |
| -void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool header) |
| 1376 | +void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool header, SynchronizationState sync_state) |
1376 | 1377 | {
|
1377 | 1378 | #ifdef Q_OS_MAC
|
1378 | 1379 | // Disabling macOS App Nap on initial sync, disk, reindex operations and mixing.
|
1379 |
| - bool disableAppNap = !m_node.masternodeSync().isSynced(); |
| 1380 | + bool disableAppNap = !m_node.masternodeSync().isSynced() || sync_state != SynchronizationState::POST_INIT; |
1380 | 1381 | #ifdef ENABLE_WALLET
|
1381 | 1382 | if (enableWallet) {
|
1382 | 1383 | for (const auto& wallet : m_node.walletLoader().getWallets()) {
|
@@ -1495,7 +1496,7 @@ void BitcoinGUI::setAdditionalDataSyncProgress(double nSyncProgress)
|
1495 | 1496 |
|
1496 | 1497 | // If masternodeSync->Reset() has been called make sure status bar shows the correct information.
|
1497 | 1498 | if (nSyncProgress == -1) {
|
1498 |
| - setNumBlocks(m_node.getNumBlocks(), QDateTime::fromTime_t(m_node.getLastBlockTime()), QString::fromStdString(m_node.getLastBlockHash()), m_node.getVerificationProgress(), false); |
| 1499 | + setNumBlocks(m_node.getNumBlocks(), QDateTime::fromTime_t(m_node.getLastBlockTime()), QString::fromStdString(m_node.getLastBlockHash()), m_node.getVerificationProgress(), false, SynchronizationState::INIT_DOWNLOAD); |
1499 | 1500 | if (clientModel->getNumConnections()) {
|
1500 | 1501 | labelBlocksIcon->show();
|
1501 | 1502 | startSpinner();
|
|
0 commit comments