Merge branch 'master' into hunicus/add-bullbit
This commit is contained in:
commit
ccd403b771
@ -21,6 +21,7 @@ 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: [],
|
||||||
@ -218,8 +219,13 @@ class DiskCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await memPool.$setMempool(data.mempool);
|
await memPool.$setMempool(data.mempool);
|
||||||
blocks.setBlocks(data.blocks);
|
if (!this.ignoreBlocksCache) {
|
||||||
blocks.setBlockSummaries(data.blockSummaries || []);
|
blocks.setBlocks(data.blocks);
|
||||||
|
blocks.setBlockSummaries(data.blockSummaries || []);
|
||||||
|
} else {
|
||||||
|
logger.info('Re-saving cache with empty recent blocks data');
|
||||||
|
await this.$saveCacheToDisk(true);
|
||||||
|
}
|
||||||
} 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));
|
||||||
}
|
}
|
||||||
@ -273,6 +279,10 @@ class DiskCache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public setIgnoreBlocksCache(): void {
|
||||||
|
this.ignoreBlocksCache = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new DiskCache();
|
export default new DiskCache();
|
||||||
|
@ -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.wipeCache();
|
diskCache.setIgnoreBlocksCache();
|
||||||
|
|
||||||
await this.$insertUnknownPool();
|
await this.$insertUnknownPool();
|
||||||
|
|
||||||
@ -118,10 +118,6 @@ class PoolsParser {
|
|||||||
* @param pool
|
* @param pool
|
||||||
*/
|
*/
|
||||||
private async $deleteBlocksForPool(pool: PoolTag): Promise<void> {
|
private async $deleteBlocksForPool(pool: PoolTag): Promise<void> {
|
||||||
if (config.MEMPOOL.AUTOMATIC_BLOCK_REINDEXING === false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get oldest blocks mined by the pool and assume pools-v2.json updates only concern most recent years
|
// Get oldest blocks mined by the pool and assume pools-v2.json updates only concern most recent years
|
||||||
// Ignore early days of Bitcoin as there were no mining pool yet
|
// Ignore early days of Bitcoin as there were no mining pool yet
|
||||||
const [oldestPoolBlock]: any[] = await DB.query(`
|
const [oldestPoolBlock]: any[] = await DB.query(`
|
||||||
|
@ -217,9 +217,9 @@
|
|||||||
<img class="image" src="/resources/profile/nix-bitcoin.png" />
|
<img class="image" src="/resources/profile/nix-bitcoin.png" />
|
||||||
<span>NixOS</span>
|
<span>NixOS</span>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/Start9Labs/embassy-os" target="_blank" title="EmbassyOS">
|
<a href="https://github.com/Start9Labs/start-os" target="_blank" title="StartOS">
|
||||||
<img class="image" src="/resources/profile/start9.png" />
|
<img class="image" src="/resources/profile/start9.png" />
|
||||||
<span>EmbassyOS</span>
|
<span>StartOS</span>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/btcpayserver/btcpayserver" target="_blank" title="BTCPay Server">
|
<a href="https://github.com/btcpayserver/btcpayserver" target="_blank" title="BTCPay Server">
|
||||||
<img class="image not-rounded" src="/resources/profile/btcpayserver.svg" />
|
<img class="image not-rounded" src="/resources/profile/btcpayserver.svg" />
|
||||||
|
@ -59,7 +59,7 @@ location = / {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# cache /<lang>/main.f40e91d908a068a2.js forever since they never change
|
# cache /<lang>/main.f40e91d908a068a2.js forever since they never change
|
||||||
location ~ ^/([a-z][a-z])/(.+\..+\.(js|css)) {
|
location ~ ^/([a-z][a-z])/(.+\..+\.(js|css))$ {
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
expires 1y;
|
expires 1y;
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ location /resources/config. {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# cache /main.f40e91d908a068a2.js forever since they never change
|
# cache /main.f40e91d908a068a2.js forever since they never change
|
||||||
location ~* ^/.+\..+\.(js|css) {
|
location ~* ^/.+\..+\.(js|css)$ {
|
||||||
try_files /$lang/$uri /en-US/$uri =404;
|
try_files /$lang/$uri /en-US/$uri =404;
|
||||||
expires 1y;
|
expires 1y;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user