apt -y install wget gpg software-properties-common
# 2. Add Kitware repository (for modern CMake > 3.20)
- wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
+ wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null
apt update
this->onConnectionStatusChanged(status);
if (status == Wallet::ConnectionStatus_Disconnected) {
- QTimer::singleShot(2000, m_nodes, [this]{ m_nodes->autoConnect(); });
+ QTimer::singleShot(2000, m_nodes, [this]{ m_nodes->autoConnect(); });
} else {
- m_nodes->autoConnect();
+ m_nodes->autoConnect();
}
this->updateBalance();
const auto elapsed = now - last;
if (elapsed >= std::chrono::seconds(m_refreshInterval) || m_refreshNow)
{
- m_lastRefreshTime = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
- last = std::chrono::steady_clock::now();
-
- qDebug() << "Refresher: Interval met. Elapsed:" << std::chrono::duration_cast<std::chrono::seconds>(elapsed).count()
- << "Interval:" << m_refreshInterval << "RefreshNow:" << m_refreshNow;
- m_refreshNow = false;
-
+ auto loopStartTime = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::steady_clock::now());
// get daemonHeight and targetHeight
// daemonHeight and targetHeight will be 0 if call to get_info fails
quint64 daemonHeight = m_walletImpl->daemonBlockChainHeight();
bool success = daemonHeight > 0;
+ if (success) {
+ m_lastRefreshTime = loopStartTime.time_since_epoch().count();
+ last = loopStartTime;
+ } else {
+ // If sync failed, retry in 10 seconds (or immediately if interval < 10s)
+ auto retryDelay = std::min(std::chrono::seconds(m_refreshInterval), std::chrono::seconds(10));
+ auto nextTime = loopStartTime - std::chrono::seconds(m_refreshInterval) + retryDelay;
+ m_lastRefreshTime = nextTime.time_since_epoch().count();
+ last = nextTime;
+ }
+
+ qDebug() << "Refresher: Interval met. Elapsed:" << std::chrono::duration_cast<std::chrono::seconds>(elapsed).count()
+ << "Interval:" << m_refreshInterval << "RefreshNow:" << m_refreshNow;
+
+
quint64 targetHeight = 0;
if (success) {
targetHeight = m_walletImpl->daemonBlockChainTargetHeight();