mirror of
https://github.com/mempool/mempool.git
synced 2025-03-13 11:36:07 +01:00
Merge pull request #5095 from mempool/mononaut/fix-local-acc-history
Fix local acceleration filter & reindex
This commit is contained in:
commit
52fa6a0f78
2 changed files with 16 additions and 2 deletions
|
@ -7,7 +7,7 @@ import cpfpRepository from '../repositories/CpfpRepository';
|
|||
import { RowDataPacket } from 'mysql2';
|
||||
|
||||
class DatabaseMigration {
|
||||
private static currentVersion = 78;
|
||||
private static currentVersion = 79;
|
||||
private queryTimeout = 3600_000;
|
||||
private statisticsAddedIndexed = false;
|
||||
private uniqueLogs: string[] = [];
|
||||
|
@ -674,6 +674,18 @@ class DatabaseMigration {
|
|||
await this.$executeQuery('ALTER TABLE `prices` CHANGE `time` `time` datetime NOT NULL');
|
||||
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;
|
||||
try {
|
||||
while (!done) {
|
||||
// don't DDoS the services backend
|
||||
Common.sleep$(500 + (Math.random() * 1000));
|
||||
const accelerations = await accelerationApi.$fetchAccelerationHistory(page);
|
||||
page++;
|
||||
if (!accelerations?.length) {
|
||||
|
@ -309,7 +311,7 @@ class AccelerationRepository {
|
|||
pools: acc.pools.map(pool => pool.pool_unique_id),
|
||||
}))
|
||||
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 accelerationInfo = accelerationCosts.getAccelerationInfo(tx, boostRate, transactions);
|
||||
accelerationInfo.cost = Math.max(0, Math.min(acc.feeDelta, accelerationInfo.cost));
|
||||
|
|
Loading…
Add table
Reference in a new issue