db migration to reindex blocks since first annex tx

This commit is contained in:
Mononaut
2025-05-10 17:29:38 +00:00
parent 7758e02924
commit af186c633c

View File

@@ -7,7 +7,7 @@ import cpfpRepository from '../repositories/CpfpRepository';
import { RowDataPacket } from 'mysql2';
class DatabaseMigration {
private static currentVersion = 97;
private static currentVersion = 98;
private queryTimeout = 3600_000;
private statisticsAddedIndexed = false;
private uniqueLogs: string[] = [];
@@ -1146,6 +1146,14 @@ class DatabaseMigration {
await this.$executeQuery(`ALTER TABLE blocks MODIFY COLUMN definition_hash varchar(255) NULL DEFAULT "${poolJsonSha}"`);
await this.updateToSchemaVersion(97);
}
// reindex mainnet Goggles flags for mined block templates above height 896070
// (since the first annex transaction at height 896071)
// (safe to make this conditional on the network since it doesn't change the database schema)
if (databaseSchemaVersion < 98 && config.MEMPOOL.NETWORK === 'mainnet') {
await this.$executeQuery('UPDATE blocks_summaries SET version = 0 WHERE height >= 896070;');
await this.updateToSchemaVersion(98);
}
}
/**