From ea420773204d51981dcfb1489f2880f75bc32813 Mon Sep 17 00:00:00 2001
From: hunicus <93150691+hunicus@users.noreply.github.com>
Date: Thu, 25 May 2023 00:31:44 -0400
Subject: [PATCH 1/7] Change embassyos to startos
---
frontend/src/app/components/about/about.component.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/frontend/src/app/components/about/about.component.html b/frontend/src/app/components/about/about.component.html
index e67facfe1..095b311b9 100644
--- a/frontend/src/app/components/about/about.component.html
+++ b/frontend/src/app/components/about/about.component.html
@@ -205,9 +205,9 @@
NixOS
-
+
- EmbassyOS
+ StartOS
From ad4c7d7c0b5c53b75e6fb921aff0c9c93faeb5bb Mon Sep 17 00:00:00 2001
From: Stephan Oeste
Date: Thu, 25 May 2023 16:50:56 +0200
Subject: [PATCH 2/7] Fix exact match of .js files. Was also matching .json
before.
---
production/nginx/server-common.conf | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/production/nginx/server-common.conf b/production/nginx/server-common.conf
index dedd36411..6b737b056 100644
--- a/production/nginx/server-common.conf
+++ b/production/nginx/server-common.conf
@@ -59,7 +59,7 @@ location = / {
}
# cache //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;
expires 1y;
}
@@ -82,7 +82,7 @@ location /resources {
expires 1w;
}
# cache /main.f40e91d908a068a2.js forever since they never change
-location ~* ^/.+\..+\.(js|css) {
+location ~* ^/.+\..+\.(js|css)$ {
try_files /$lang/$uri /en-US/$uri =404;
expires 1y;
}
From 714208a3669000c4f20777f6d0118ed8b4f35a83 Mon Sep 17 00:00:00 2001
From: softsimon
Date: Thu, 25 May 2023 19:05:29 +0400
Subject: [PATCH 3/7] Don't wipe mempool cache in pools updater
---
backend/src/api/disk-cache.ts | 11 +++++++++--
backend/src/api/pools-parser.ts | 2 +-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/backend/src/api/disk-cache.ts b/backend/src/api/disk-cache.ts
index 0264fe1a3..2e3ff6fb1 100644
--- a/backend/src/api/disk-cache.ts
+++ b/backend/src/api/disk-cache.ts
@@ -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);
- blocks.setBlocks(data.blocks);
- blocks.setBlockSummaries(data.blockSummaries || []);
+ 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();
diff --git a/backend/src/api/pools-parser.ts b/backend/src/api/pools-parser.ts
index f94c147a2..7397c5639 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.wipeCache();
+ diskCache.setIgnoreBlocksCache();
await this.$insertUnknownPool();
From 349ba613ddc40d8d87f1907797e9bc2fbbc9c030 Mon Sep 17 00:00:00 2001
From: softsimon
Date: Thu, 25 May 2023 19:06:45 +0400
Subject: [PATCH 4/7] 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();
From aeb896e200281af1bdb2190c9dd64612eac583a0 Mon Sep 17 00:00:00 2001
From: softsimon
Date: Thu, 25 May 2023 19:05:29 +0400
Subject: [PATCH 5/7] Don't wipe mempool cache in pools updater
---
backend/src/api/disk-cache.ts | 11 +++++++++--
backend/src/api/pools-parser.ts | 2 +-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/backend/src/api/disk-cache.ts b/backend/src/api/disk-cache.ts
index 0264fe1a3..2e3ff6fb1 100644
--- a/backend/src/api/disk-cache.ts
+++ b/backend/src/api/disk-cache.ts
@@ -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);
- blocks.setBlocks(data.blocks);
- blocks.setBlockSummaries(data.blockSummaries || []);
+ 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();
diff --git a/backend/src/api/pools-parser.ts b/backend/src/api/pools-parser.ts
index f94c147a2..7397c5639 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.wipeCache();
+ diskCache.setIgnoreBlocksCache();
await this.$insertUnknownPool();
From 038f9659bb9b55c5634729f5e6aef1a8a5160256 Mon Sep 17 00:00:00 2001
From: softsimon
Date: Thu, 25 May 2023 19:19:14 +0400
Subject: [PATCH 6/7] Save new disk cache after ignoring blocks
---
backend/src/api/disk-cache.ts | 3 +++
1 file changed, 3 insertions(+)
diff --git a/backend/src/api/disk-cache.ts b/backend/src/api/disk-cache.ts
index 2e3ff6fb1..17d75d07b 100644
--- a/backend/src/api/disk-cache.ts
+++ b/backend/src/api/disk-cache.ts
@@ -222,6 +222,9 @@ class DiskCache {
if (!this.ignoreBlocksCache) {
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) {
logger.warn('Failed to parse mempoool and blocks cache. Skipping. Reason: ' + (e instanceof Error ? e.message : e));
From 8ffe2f3156d61c577325c39ddd68219e70166cb2 Mon Sep 17 00:00:00 2001
From: nymkappa <1612910616@pm.me>
Date: Thu, 25 May 2023 09:08:51 -0700
Subject: [PATCH 7/7] Always re-indexing blocks when updating mining pools
---
backend/src/api/pools-parser.ts | 4 ----
1 file changed, 4 deletions(-)
diff --git a/backend/src/api/pools-parser.ts b/backend/src/api/pools-parser.ts
index 7397c5639..0d34925ab 100644
--- a/backend/src/api/pools-parser.ts
+++ b/backend/src/api/pools-parser.ts
@@ -118,10 +118,6 @@ class PoolsParser {
* @param pool
*/
private async $deleteBlocksForPool(pool: PoolTag): Promise {
- 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
// Ignore early days of Bitcoin as there were no mining pool yet
const [oldestPoolBlock]: any[] = await DB.query(`