Fix Goggles indexing when summaries disabled

This commit is contained in:
Mononaut 2024-01-23 13:33:59 +00:00
parent 7405cf8336
commit 82920f621f
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E
2 changed files with 5 additions and 5 deletions

View File

@ -566,7 +566,7 @@ class Blocks {
*/ */
public async $classifyBlocks(): Promise<void> { public async $classifyBlocks(): Promise<void> {
// classification requires an esplora backend // classification requires an esplora backend
if (config.MEMPOOL.BACKEND !== 'esplora') { if (!Common.blocksSummariesIndexingEnabled() || config.MEMPOOL.BACKEND !== 'esplora') {
return; return;
} }
@ -577,7 +577,7 @@ class Blocks {
const unclassifiedTemplatesList = await BlocksSummariesRepository.$getTemplatesWithVersion(0); const unclassifiedTemplatesList = await BlocksSummariesRepository.$getTemplatesWithVersion(0);
// nothing to do // nothing to do
if (!unclassifiedBlocksList.length && !unclassifiedTemplatesList.length) { if (!unclassifiedBlocksList?.length && !unclassifiedTemplatesList?.length) {
return; return;
} }
@ -586,8 +586,8 @@ class Blocks {
let indexedTotal = 0; let indexedTotal = 0;
const minHeight = Math.min( const minHeight = Math.min(
unclassifiedBlocksList[unclassifiedBlocksList.length - 1].height ?? Infinity, unclassifiedBlocksList[unclassifiedBlocksList.length - 1]?.height ?? Infinity,
unclassifiedTemplatesList[unclassifiedTemplatesList.length - 1].height ?? Infinity, unclassifiedTemplatesList[unclassifiedTemplatesList.length - 1]?.height ?? Infinity,
); );
const numToIndex = Math.max( const numToIndex = Math.max(
unclassifiedBlocksList.length, unclassifiedBlocksList.length,

View File

@ -559,7 +559,7 @@ class DatabaseMigration {
await this.updateToSchemaVersion(66); await this.updateToSchemaVersion(66);
} }
if (databaseSchemaVersion < 67) { if (databaseSchemaVersion < 67 && isBitcoin === true) {
await this.$executeQuery('ALTER TABLE `blocks_summaries` ADD version INT NOT NULL DEFAULT 0'); await this.$executeQuery('ALTER TABLE `blocks_summaries` ADD version INT NOT NULL DEFAULT 0');
await this.$executeQuery('ALTER TABLE `blocks_summaries` ADD INDEX `version` (`version`)'); await this.$executeQuery('ALTER TABLE `blocks_summaries` ADD INDEX `version` (`version`)');
await this.$executeQuery('ALTER TABLE `blocks_templates` ADD version INT NOT NULL DEFAULT 0'); await this.$executeQuery('ALTER TABLE `blocks_templates` ADD version INT NOT NULL DEFAULT 0');