|
37 | 37 | #include <ui_interface.h>
|
38 | 38 | #include <util/system.h>
|
39 | 39 | #include <util/translation.h>
|
| 40 | +#include <validation.h> |
40 | 41 |
|
41 | 42 | #include <QAction>
|
42 | 43 | #include <QApplication>
|
@@ -567,7 +568,7 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
|
567 | 568 | connect(_clientModel, &ClientModel::networkActiveChanged, this, &BitcoinGUI::setNetworkActive);
|
568 | 569 |
|
569 | 570 | modalOverlay->setKnownBestHeight(_clientModel->getHeaderTipHeight(), QDateTime::fromTime_t(_clientModel->getHeaderTipTime()));
|
570 |
| - setNumBlocks(m_node.getNumBlocks(), QDateTime::fromTime_t(m_node.getLastBlockTime()), m_node.getVerificationProgress(), false); |
| 571 | + setNumBlocks(m_node.getNumBlocks(), QDateTime::fromTime_t(m_node.getLastBlockTime()), m_node.getVerificationProgress(), false, SynchronizationState::INIT_DOWNLOAD); |
571 | 572 | connect(_clientModel, &ClientModel::numBlocksChanged, this, &BitcoinGUI::setNumBlocks);
|
572 | 573 |
|
573 | 574 | // Receive and report messages from client model
|
@@ -926,11 +927,15 @@ void BitcoinGUI::openOptionsDialogWithTab(OptionsDialog::Tab tab)
|
926 | 927 | dlg.exec();
|
927 | 928 | }
|
928 | 929 |
|
929 |
| -void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool header) |
| 930 | +void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool header, SynchronizationState sync_state) |
930 | 931 | {
|
931 | 932 | // Disabling macOS App Nap on initial sync, disk and reindex operations.
|
932 | 933 | #ifdef Q_OS_MAC
|
933 |
| - (m_node.isInitialBlockDownload() || m_node.getReindex() || m_node.getImporting()) ? m_app_nap_inhibitor->disableAppNap() : m_app_nap_inhibitor->enableAppNap(); |
| 934 | + if (sync_state == SynchronizationState::POST_INIT) { |
| 935 | + m_app_nap_inhibitor->enableAppNap(); |
| 936 | + } else { |
| 937 | + m_app_nap_inhibitor->disableAppNap(); |
| 938 | + } |
934 | 939 | #endif
|
935 | 940 |
|
936 | 941 | if (modalOverlay)
|
|
0 commit comments