From 349ba613ddc40d8d87f1907797e9bc2fbbc9c030 Mon Sep 17 00:00:00 2001 From: softsimon Date: Thu, 25 May 2023 19:06:45 +0400 Subject: [PATCH] Revert "Don't wipe mempool cache in pools updater" This reverts commit 714208a3669000c4f20777f6d0118ed8b4f35a83. --- backend/src/api/disk-cache.ts | 11 ++--------- backend/src/api/pools-parser.ts | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/backend/src/api/disk-cache.ts b/backend/src/api/disk-cache.ts index 2e3ff6fb1..0264fe1a3 100644 --- a/backend/src/api/disk-cache.ts +++ b/backend/src/api/disk-cache.ts @@ -21,7 +21,6 @@ class DiskCache { private static RBF_FILE_NAME = config.MEMPOOL.CACHE_DIR + '/rbfcache.json'; private static CHUNK_FILES = 25; private isWritingCache = false; - private ignoreBlocksCache = false; private semaphore: { resume: (() => void)[], locks: number } = { resume: [], @@ -219,10 +218,8 @@ class DiskCache { } await memPool.$setMempool(data.mempool); - if (!this.ignoreBlocksCache) { - blocks.setBlocks(data.blocks); - blocks.setBlockSummaries(data.blockSummaries || []); - } + blocks.setBlocks(data.blocks); + blocks.setBlockSummaries(data.blockSummaries || []); } catch (e) { logger.warn('Failed to parse mempoool and blocks cache. Skipping. Reason: ' + (e instanceof Error ? e.message : e)); } @@ -276,10 +273,6 @@ class DiskCache { } } } - - public setIgnoreBlocksCache(): void { - this.ignoreBlocksCache = true; - } } export default new DiskCache(); diff --git a/backend/src/api/pools-parser.ts b/backend/src/api/pools-parser.ts index 7397c5639..f94c147a2 100644 --- a/backend/src/api/pools-parser.ts +++ b/backend/src/api/pools-parser.ts @@ -41,7 +41,7 @@ class PoolsParser { public async migratePoolsJson(): Promise { // 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.setIgnoreBlocksCache(); + diskCache.wipeCache(); await this.$insertUnknownPool();