Fix local acceleration filter & reindex
This commit is contained in:
parent
2ff2b78d26
commit
ce204d03c6
@ -7,7 +7,7 @@ import cpfpRepository from '../repositories/CpfpRepository';
|
|||||||
import { RowDataPacket } from 'mysql2';
|
import { RowDataPacket } from 'mysql2';
|
||||||
|
|
||||||
class DatabaseMigration {
|
class DatabaseMigration {
|
||||||
private static currentVersion = 78;
|
private static currentVersion = 79;
|
||||||
private queryTimeout = 3600_000;
|
private queryTimeout = 3600_000;
|
||||||
private statisticsAddedIndexed = false;
|
private statisticsAddedIndexed = false;
|
||||||
private uniqueLogs: string[] = [];
|
private uniqueLogs: string[] = [];
|
||||||
@ -674,6 +674,18 @@ class DatabaseMigration {
|
|||||||
await this.$executeQuery('ALTER TABLE `prices` CHANGE `time` `time` datetime NOT NULL');
|
await this.$executeQuery('ALTER TABLE `prices` CHANGE `time` `time` datetime NOT NULL');
|
||||||
await this.updateToSchemaVersion(78);
|
await this.updateToSchemaVersion(78);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (databaseSchemaVersion < 79 && config.MEMPOOL.NETWORK === 'mainnet') {
|
||||||
|
// Clear bad data
|
||||||
|
await this.$executeQuery(`TRUNCATE accelerations`);
|
||||||
|
this.uniqueLog(logger.notice, `'accelerations' table has been truncated`);
|
||||||
|
await this.$executeQuery(`
|
||||||
|
UPDATE state
|
||||||
|
SET number = 0
|
||||||
|
WHERE name = 'last_acceleration_block'
|
||||||
|
`);
|
||||||
|
await this.updateToSchemaVersion(79);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -244,6 +244,8 @@ class AccelerationRepository {
|
|||||||
let count = 0;
|
let count = 0;
|
||||||
try {
|
try {
|
||||||
while (!done) {
|
while (!done) {
|
||||||
|
// don't DDoS the services backend
|
||||||
|
Common.sleep$(500 + (Math.random() * 1000));
|
||||||
const accelerations = await accelerationApi.$fetchAccelerationHistory(page);
|
const accelerations = await accelerationApi.$fetchAccelerationHistory(page);
|
||||||
page++;
|
page++;
|
||||||
if (!accelerations?.length) {
|
if (!accelerations?.length) {
|
||||||
@ -309,7 +311,7 @@ class AccelerationRepository {
|
|||||||
pools: acc.pools.map(pool => pool.pool_unique_id),
|
pools: acc.pools.map(pool => pool.pool_unique_id),
|
||||||
}))
|
}))
|
||||||
for (const acc of accelerations) {
|
for (const acc of accelerations) {
|
||||||
if (blockTxs[acc.txid]) {
|
if (blockTxs[acc.txid] && acc.pools.some(pool => pool.pool_unique_id === block.extras.pool.id)) {
|
||||||
const tx = blockTxs[acc.txid];
|
const tx = blockTxs[acc.txid];
|
||||||
const accelerationInfo = accelerationCosts.getAccelerationInfo(tx, boostRate, transactions);
|
const accelerationInfo = accelerationCosts.getAccelerationInfo(tx, boostRate, transactions);
|
||||||
accelerationInfo.cost = Math.max(0, Math.min(acc.feeDelta, accelerationInfo.cost));
|
accelerationInfo.cost = Math.max(0, Math.min(acc.feeDelta, accelerationInfo.cost));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user