diff --git a/backend/src/api/audit.ts b/backend/src/api/audit.ts index 705579b14..eea96af69 100644 --- a/backend/src/api/audit.ts +++ b/backend/src/api/audit.ts @@ -21,6 +21,7 @@ class Audit { const accelerated: string[] = []; // prioritized by the mempool accelerator const isCensored = {}; // missing, without excuse const isDisplaced = {}; + const isAccelerated = {}; let displacedWeight = 0; let matchedWeight = 0; let projectedWeight = 0; @@ -33,6 +34,7 @@ class Audit { inBlock[tx.txid] = tx; if (mempool[tx.txid] && mempool[tx.txid].acceleration) { accelerated.push(tx.txid); + isAccelerated[tx.txid] = true; } } // coinbase is always expected @@ -143,7 +145,8 @@ class Audit { // so exclude from the analysis. if ((blockTx.effectiveFeePerVsize || 0) < lastEffectiveRate) { prioritized.push(blockTx.txid); - } else { + // accelerated txs may or may not have their prioritized fee rate applied, so don't use them as a reference + } else if (!isAccelerated[blockTx.txid]) { lastEffectiveRate = blockTx.effectiveFeePerVsize || 0; } } diff --git a/backend/src/api/blocks.ts b/backend/src/api/blocks.ts index e203bbd3c..a5b8af0e2 100644 --- a/backend/src/api/blocks.ts +++ b/backend/src/api/blocks.ts @@ -33,6 +33,7 @@ import AccelerationRepository from '../repositories/AccelerationRepository'; import { calculateFastBlockCpfp, calculateGoodBlockCpfp } from './cpfp'; import mempool from './mempool'; import CpfpRepository from '../repositories/CpfpRepository'; +import accelerationApi from './services/acceleration'; class Blocks { private blocks: BlockExtended[] = []; @@ -904,7 +905,12 @@ class Blocks { } } - const cpfpSummary: CpfpSummary = calculateGoodBlockCpfp(block.height, transactions, Object.values(mempool.getAccelerations()).map(a => ({ txid: a.txid, max_bid: a.feeDelta }))); + let accelerations = Object.values(mempool.getAccelerations()); + if (accelerations?.length > 0) { + const pool = await this.$findBlockMiner(transactionUtils.stripCoinbaseTransaction(transactions[0])); + accelerations = accelerations.filter(a => a.pools.includes(pool.uniqueId)); + } + const cpfpSummary: CpfpSummary = calculateGoodBlockCpfp(block.height, transactions, accelerations.map(a => ({ txid: a.txid, max_bid: a.feeDelta }))); const blockExtended: BlockExtended = await this.$getBlockExtended(block, cpfpSummary.transactions); const blockSummary: BlockSummary = this.summarizeBlockTransactions(block.id, cpfpSummary.transactions); this.updateTimerProgress(timer, `got block data for ${this.currentBlockHeight}`);