@@ -138,9 +138,10 @@ QVariantMap P2PoolStatsProvider::fetchLocal()
138138 if (isSidechainReady () && hashrate != 0 ) {
139139 map.insert (" hashrate" , formatHashrate (hashrate));
140140
141- if (m_lastUpdate.isValid () && m_hashrate_ema15m.isValid () && m_hashrate_ema1h.isValid () && m_hashrate_ema24h.isValid ()) {
141+ QDateTime now = QDateTime::currentDateTime ();
142+ if (m_lastEMAUpdate.isValid () && m_hashrate_ema15m.isValid () && m_hashrate_ema1h.isValid () && m_hashrate_ema24h.isValid ()) {
142143 int secs =
143- m_lastUpdate .secsTo (QDateTime::currentDateTime () );
144+ m_lastEMAUpdate .secsTo (now );
144145
145146 auto alpha = [&](int mins, qint64 secs) {
146147 return 1.0 - std::exp (-static_cast <double >(secs) / static_cast <double >((mins * 60 ) / 3 ));
@@ -158,6 +159,7 @@ QVariantMap P2PoolStatsProvider::fetchLocal()
158159 } else {
159160 m_hashrate_ema15m = m_hashrate_ema1h = m_hashrate_ema24h = hashrate;
160161 }
162+ m_lastEMAUpdate = now;
161163
162164 if (uptime < (15 * 60 )) {
163165 map.insert (" hashrate_ema15m" , " waiting..." );
@@ -326,16 +328,13 @@ void P2PoolStatsProvider::update()
326328 QVariantMap raw =
327329 fetchRaw ();
328330
329- m_lastUpdate =
330- QDateTime::currentDateTime ();
331-
332331 emit p2poolUpdateStats (local, pool, network, raw);
333332}
334333
335334void P2PoolStatsProvider::clear ()
336335{
337- /* invalidate lastUpdate timestamp */
338- m_lastUpdate = QDateTime ();
336+ /* invalidate lastEMAUpdate timestamp */
337+ m_lastEMAUpdate = QDateTime ();
339338
340339 /* invalidate hashrate aggregates */
341340 m_hashrate_ema15m = QVariant ();
0 commit comments