Merge pull request #2664 from mononaut/block-audit-db-migration

db migration to clear obsolete block audit data
This commit is contained in:
wiz 2022-11-22 14:40:33 +09:00 committed by GitHub
commit 38cb45e026
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -4,8 +4,8 @@ import logger from '../logger';
import { Common } from './common';
class DatabaseMigration {
private static currentVersion = 43;
private queryTimeout = 120000;
private static currentVersion = 44;
private queryTimeout = 900_000;
private statisticsAddedIndexed = false;
private uniqueLogs: string[] = [];
@ -360,6 +360,11 @@ class DatabaseMigration {
if (databaseSchemaVersion < 43 && isBitcoin === true) {
await this.$executeQuery(this.getCreateLNNodeRecordsTableQuery(), await this.$checkIfTableExists('nodes_records'));
}
if (databaseSchemaVersion < 44 && isBitcoin === true) {
await this.$executeQuery('TRUNCATE TABLE `blocks_audits`');
await this.$executeQuery('UPDATE blocks_summaries SET template = NULL');
}
}
/**

View File

@ -416,7 +416,7 @@ class WebsocketHandler {
let matchRate;
const _memPool = memPool.getMempool();
if (Common.indexingEnabled()) {
if (Common.indexingEnabled() && memPool.isInSync()) {
const mempoolCopy = cloneMempool(_memPool);
const projectedBlocks = mempoolBlocks.makeBlockTemplates(mempoolCopy, 2);