Revert "Don't wipe mempool cache in pools updater"

This reverts commit 714208a3669000c4f20777f6d0118ed8b4f35a83.
This commit is contained in:
softsimon 2023-05-25 19:06:45 +04:00
parent 714208a366
commit 349ba613dd
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7
2 changed files with 3 additions and 10 deletions

View File

@ -21,7 +21,6 @@ class DiskCache {
private static RBF_FILE_NAME = config.MEMPOOL.CACHE_DIR + '/rbfcache.json'; private static RBF_FILE_NAME = config.MEMPOOL.CACHE_DIR + '/rbfcache.json';
private static CHUNK_FILES = 25; private static CHUNK_FILES = 25;
private isWritingCache = false; private isWritingCache = false;
private ignoreBlocksCache = false;
private semaphore: { resume: (() => void)[], locks: number } = { private semaphore: { resume: (() => void)[], locks: number } = {
resume: [], resume: [],
@ -219,10 +218,8 @@ class DiskCache {
} }
await memPool.$setMempool(data.mempool); await memPool.$setMempool(data.mempool);
if (!this.ignoreBlocksCache) { blocks.setBlocks(data.blocks);
blocks.setBlocks(data.blocks); blocks.setBlockSummaries(data.blockSummaries || []);
blocks.setBlockSummaries(data.blockSummaries || []);
}
} catch (e) { } catch (e) {
logger.warn('Failed to parse mempoool and blocks cache. Skipping. Reason: ' + (e instanceof Error ? e.message : 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(); export default new DiskCache();

View File

@ -41,7 +41,7 @@ class PoolsParser {
public async migratePoolsJson(): Promise<void> { public async migratePoolsJson(): Promise<void> {
// We also need to wipe the backend cache to make sure we don't serve blocks with // 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) // the wrong mining pool (usually happen with unknown blocks)
diskCache.setIgnoreBlocksCache(); diskCache.wipeCache();
await this.$insertUnknownPool(); await this.$insertUnknownPool();