Only insert hashrate states for bitcoin

This commit is contained in:
nymkappa 2022-03-11 21:58:25 +01:00
parent 87405ec4a5
commit cd12e9bde9
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04

View File

@ -293,6 +293,7 @@ class DatabaseMigration {
*/ */
private getMigrationQueriesFromVersion(version: number): string[] { private getMigrationQueriesFromVersion(version: number): string[] {
const queries: string[] = []; const queries: string[] = [];
const isBitcoin = ['mainnet', 'testnet', 'signet'].includes(config.MEMPOOL.NETWORK);
if (version < 1) { if (version < 1) {
if (config.MEMPOOL.NETWORK !== 'liquid' && config.MEMPOOL.NETWORK !== 'liquidtestnet') { if (config.MEMPOOL.NETWORK !== 'liquid' && config.MEMPOOL.NETWORK !== 'liquidtestnet') {
@ -300,11 +301,11 @@ class DatabaseMigration {
} }
} }
if (version < 7) { if (version < 7 && isBitcoin === true) {
queries.push(`INSERT INTO state(name, number, string) VALUES ('last_hashrates_indexing', 0, NULL)`); queries.push(`INSERT INTO state(name, number, string) VALUES ('last_hashrates_indexing', 0, NULL)`);
} }
if (version < 9) { if (version < 9 && isBitcoin === true) {
queries.push(`INSERT INTO state(name, number, string) VALUES ('last_weekly_hashrates_indexing', 0, NULL)`); queries.push(`INSERT INTO state(name, number, string) VALUES ('last_weekly_hashrates_indexing', 0, NULL)`);
} }