Merge pull request #4935 from mempool/mononaut/acc-rate-tooltips

Fix accelerated fee rate in mined block tooltips
This commit is contained in:
wiz 2024-04-09 16:50:21 +09:00 committed by GitHub
commit be75a87e88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -68,7 +68,7 @@ export class BlockOverviewTooltipComponent implements OnChanges {
this.effectiveRate = this.tx.rate;
const txFlags = BigInt(this.tx.flags) || 0n;
this.acceleration = this.tx.acc || (txFlags & TransactionFlags.acceleration);
this.hasEffectiveRate = Math.abs((this.fee / this.vsize) - this.effectiveRate) > 0.05
this.hasEffectiveRate = this.tx.acc || Math.abs((this.fee / this.vsize) - this.effectiveRate) > 0.05
|| (txFlags && (txFlags & (TransactionFlags.cpfp_child | TransactionFlags.cpfp_parent)) > 0n);
this.filters = this.tx.flags ? toFilters(txFlags).filter(f => f.tooltip) : [];
this.activeFilters = {}

View File

@ -365,6 +365,12 @@ export class BlockComponent implements OnInit, OnDestroy {
for (const tx of transactions) {
if (acceleratedInBlock[tx.txid]) {
tx.acc = true;
const acceleration = acceleratedInBlock[tx.txid];
const boostCost = acceleration.boostCost || (acceleration.feePaid - acceleration.baseFee - acceleration.vsizeFee);
const acceleratedFeeRate = Math.max(acceleration.effectiveFee, acceleration.effectiveFee + boostCost) / acceleration.effectiveVsize;
if (acceleratedFeeRate > tx.rate) {
tx.rate = acceleratedFeeRate;
}
} else {
tx.acc = false;
}