Only reset hashrate state flag after database migration - Fix weekly hashrate indexing bug

This commit is contained in:
nymkappa committed 2022-03-05 13:54:07 +01:00
1 parent 67b45e2040
commit 5b62ed0b50
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -142,8 +142,8 @@ class Mining {
lastBlockHashrate = await bitcoinClient.getNetworkHashPs(blockStats.blockCount,
blockStats.lastBlockHeight);
if (totalIndexed % 7 === 0 && !indexedTimestamp.includes(fromTimestamp + 1)) { // Save weekly pools hashrate
logger.debug("Indexing weekly hashrates for mining pools");
if (totalIndexed > 7 && totalIndexed % 7 === 0 && !indexedTimestamp.includes(fromTimestamp + 1)) { // Save weekly pools hashrate
logger.debug(`Indexing weekly hashrates for mining pools (timestamp: ${fromTimestamp})`);
let pools = await PoolsRepository.$getPoolsInfoBetween(fromTimestamp - 604800, fromTimestamp);
const totalBlocks = pools.reduce((acc, pool) => acc + pool.blockCount, 0);
pools = pools.map((pool: any) => {