Calculate & save acceleration bid boost rates
This commit is contained in:
@@ -7,7 +7,7 @@ import cpfpRepository from '../repositories/CpfpRepository';
|
||||
import { RowDataPacket } from 'mysql2';
|
||||
|
||||
class DatabaseMigration {
|
||||
private static currentVersion = 68;
|
||||
private static currentVersion = 69;
|
||||
private queryTimeout = 3600_000;
|
||||
private statisticsAddedIndexed = false;
|
||||
private uniqueLogs: string[] = [];
|
||||
@@ -580,6 +580,11 @@ class DatabaseMigration {
|
||||
await this.$executeQuery(`INSERT INTO state VALUES('last_bitcoin_block_audit', 0, NULL);`);
|
||||
await this.updateToSchemaVersion(68);
|
||||
}
|
||||
|
||||
if (databaseSchemaVersion < 69 && config.MEMPOOL.NETWORK === 'mainnet') {
|
||||
await this.$executeQuery(this.getCreateAccelerationsTableQuery(), await this.$checkIfTableExists('accelerations'));
|
||||
await this.updateToSchemaVersion(69);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1123,6 +1128,23 @@ class DatabaseMigration {
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;`;
|
||||
}
|
||||
|
||||
private getCreateAccelerationsTableQuery(): string {
|
||||
return `CREATE TABLE IF NOT EXISTS accelerations (
|
||||
txid varchar(65) NOT NULL,
|
||||
added date NOT NULL,
|
||||
height int(10) NOT NULL,
|
||||
pool smallint unsigned NULL,
|
||||
effective_vsize int(10) NOT NULL,
|
||||
effective_fee bigint(20) unsigned NOT NULL,
|
||||
boost_rate float unsigned,
|
||||
boost_cost bigint(20) unsigned NOT NULL,
|
||||
PRIMARY KEY (txid),
|
||||
INDEX (added),
|
||||
INDEX (height),
|
||||
INDEX (pool)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;`;
|
||||
}
|
||||
|
||||
public async $blocksReindexingTruncate(): Promise<void> {
|
||||
logger.warn(`Truncating pools, blocks, hashrates and difficulty_adjustments tables for re-indexing (using '--reindex-blocks'). You can cancel this command within 5 seconds`);
|
||||
await Common.sleep$(5000);
|
||||
|
||||
Reference in New Issue
Block a user