diff --git a/backend/src/api/disk-cache.ts b/backend/src/api/disk-cache.ts index a75fd43cc..e466982ad 100644 --- a/backend/src/api/disk-cache.ts +++ b/backend/src/api/disk-cache.ts @@ -62,6 +62,7 @@ class DiskCache { } wipeCache() { + logger.notice(`Wipping nodejs backend cache/cache*.json files`); fs.unlinkSync(DiskCache.FILE_NAME); for (let i = 1; i < DiskCache.CHUNK_FILES; i++) { fs.unlinkSync(DiskCache.FILE_NAMES.replace('{number}', i.toString())); diff --git a/backend/src/api/pools-parser.ts b/backend/src/api/pools-parser.ts index 4e67ce98b..d1705b829 100644 --- a/backend/src/api/pools-parser.ts +++ b/backend/src/api/pools-parser.ts @@ -3,6 +3,7 @@ import logger from '../logger'; import config from '../config'; import PoolsRepository from '../repositories/PoolsRepository'; import { PoolTag } from '../mempool.interfaces'; +import diskCache from './disk-cache'; class PoolsParser { miningPools: any[] = []; @@ -139,6 +140,10 @@ class PoolsParser { WHERE pool_id = ?`, [pool.id] ); + + // We also need to wipe the backend cache to make sure we don't serve blocks with + // the wrong mining pool (usually happen with unknown blocks) + diskCache.wipeCache(); } private async $deleteUnknownBlocks(): Promise { @@ -149,6 +154,10 @@ class PoolsParser { WHERE pool_id = ? AND height >= 130635`, [unknownPool[0].id] ); + + // We also need to wipe the backend cache to make sure we don't serve blocks with + // the wrong mining pool (usually happen with unknown blocks) + diskCache.wipeCache(); } }