Don't wipe mempool cache in pools updater
This commit is contained in:
		
							parent
							
								
									349ba613dd
								
							
						
					
					
						commit
						aeb896e200
					
				| @ -21,6 +21,7 @@ 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: [], | ||||
| @ -218,8 +219,10 @@ class DiskCache { | ||||
|       } | ||||
| 
 | ||||
|       await memPool.$setMempool(data.mempool); | ||||
|       if (!this.ignoreBlocksCache) { | ||||
|         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)); | ||||
|     } | ||||
| @ -273,6 +276,10 @@ class DiskCache { | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   public setIgnoreBlocksCache(): void { | ||||
|     this.ignoreBlocksCache = true; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| export default new DiskCache(); | ||||
|  | ||||
| @ -41,7 +41,7 @@ class PoolsParser { | ||||
|   public async migratePoolsJson(): Promise<void> { | ||||
|     // 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(); | ||||
|     diskCache.setIgnoreBlocksCache(); | ||||
| 
 | ||||
|     await this.$insertUnknownPool(); | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user