mirror of
https://github.com/mempool/mempool.git
synced 2025-03-13 03:24:28 +01:00
Fix cpfp vsize rounding & goggles bugs
This commit is contained in:
parent
41c373c39d
commit
79eb9635c2
4 changed files with 7 additions and 4 deletions
|
@ -1151,7 +1151,7 @@ class Blocks {
|
||||||
transactions: cpfpSummary.transactions.map(tx => {
|
transactions: cpfpSummary.transactions.map(tx => {
|
||||||
let flags: number = 0;
|
let flags: number = 0;
|
||||||
try {
|
try {
|
||||||
flags = tx.flags || Common.getTransactionFlags(tx);
|
flags = Common.getTransactionFlags(tx);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.warn('Failed to classify transaction: ' + (e instanceof Error ? e.message : e));
|
logger.warn('Failed to classify transaction: ' + (e instanceof Error ? e.message : e));
|
||||||
}
|
}
|
||||||
|
|
|
@ -419,12 +419,15 @@ export class Common {
|
||||||
let flags = tx.flags ? BigInt(tx.flags) : 0n;
|
let flags = tx.flags ? BigInt(tx.flags) : 0n;
|
||||||
|
|
||||||
// Update variable flags (CPFP, RBF)
|
// Update variable flags (CPFP, RBF)
|
||||||
|
flags &= ~TransactionFlags.cpfp_child;
|
||||||
if (tx.ancestors?.length) {
|
if (tx.ancestors?.length) {
|
||||||
flags |= TransactionFlags.cpfp_child;
|
flags |= TransactionFlags.cpfp_child;
|
||||||
}
|
}
|
||||||
|
flags &= ~TransactionFlags.cpfp_parent;
|
||||||
if (tx.descendants?.length) {
|
if (tx.descendants?.length) {
|
||||||
flags |= TransactionFlags.cpfp_parent;
|
flags |= TransactionFlags.cpfp_parent;
|
||||||
}
|
}
|
||||||
|
flags &= ~TransactionFlags.replacement;
|
||||||
if (tx.replacement) {
|
if (tx.replacement) {
|
||||||
flags |= TransactionFlags.replacement;
|
flags |= TransactionFlags.replacement;
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ class TransactionUtils {
|
||||||
}
|
}
|
||||||
const feePerVbytes = (transaction.fee || 0) / (transaction.weight / 4);
|
const feePerVbytes = (transaction.fee || 0) / (transaction.weight / 4);
|
||||||
const transactionExtended: TransactionExtended = Object.assign({
|
const transactionExtended: TransactionExtended = Object.assign({
|
||||||
vsize: Math.round(transaction.weight / 4),
|
vsize: transaction.weight / 4,
|
||||||
feePerVsize: feePerVbytes,
|
feePerVsize: feePerVbytes,
|
||||||
effectiveFeePerVsize: feePerVbytes,
|
effectiveFeePerVsize: feePerVbytes,
|
||||||
}, transaction);
|
}, transaction);
|
||||||
|
@ -123,7 +123,7 @@ class TransactionUtils {
|
||||||
const adjustedFeePerVsize = (transaction.fee || 0) / adjustedVsize;
|
const adjustedFeePerVsize = (transaction.fee || 0) / adjustedVsize;
|
||||||
const transactionExtended: MempoolTransactionExtended = Object.assign(transaction, {
|
const transactionExtended: MempoolTransactionExtended = Object.assign(transaction, {
|
||||||
order: this.txidToOrdering(transaction.txid),
|
order: this.txidToOrdering(transaction.txid),
|
||||||
vsize: Math.round(transaction.weight / 4),
|
vsize,
|
||||||
adjustedVsize,
|
adjustedVsize,
|
||||||
sigops,
|
sigops,
|
||||||
feePerVsize: feePerVbytes,
|
feePerVsize: feePerVbytes,
|
||||||
|
|
|
@ -68,7 +68,7 @@ export class BlockOverviewTooltipComponent implements OnChanges {
|
||||||
this.effectiveRate = this.tx.rate;
|
this.effectiveRate = this.tx.rate;
|
||||||
const txFlags = BigInt(this.tx.flags) || 0n;
|
const txFlags = BigInt(this.tx.flags) || 0n;
|
||||||
this.acceleration = this.tx.acc || (txFlags & TransactionFlags.acceleration);
|
this.acceleration = this.tx.acc || (txFlags & TransactionFlags.acceleration);
|
||||||
this.hasEffectiveRate = this.tx.acc || 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 && Math.abs((this.fee / Math.ceil(this.vsize)) - this.effectiveRate) <= 0.05)
|
||||||
|| (txFlags && (txFlags & (TransactionFlags.cpfp_child | TransactionFlags.cpfp_parent)) > 0n);
|
|| (txFlags && (txFlags & (TransactionFlags.cpfp_child | TransactionFlags.cpfp_parent)) > 0n);
|
||||||
this.filters = this.tx.flags ? toFilters(txFlags).filter(f => f.tooltip) : [];
|
this.filters = this.tx.flags ? toFilters(txFlags).filter(f => f.tooltip) : [];
|
||||||
this.activeFilters = {}
|
this.activeFilters = {}
|
||||||
|
|
Loading…
Add table
Reference in a new issue