Fix effective fee rate detection on tx page

This commit is contained in:
Mononaut 2024-07-30 11:49:52 +00:00
parent fb335f62db
commit 5870782abf
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E
2 changed files with 5 additions and 4 deletions

View File

@ -622,8 +622,8 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
ancestors: tx.ancestors, ancestors: tx.ancestors,
bestDescendant: tx.bestDescendant, bestDescendant: tx.bestDescendant,
}); });
const hasRelatives = !!(tx.ancestors?.length || tx.bestDescendant); const hasRelatives = !!(tx.ancestors?.length || tx.bestDescendant || tx.descendants);
this.hasEffectiveFeeRate = hasRelatives || (tx.effectiveFeePerVsize && (Math.abs(tx.effectiveFeePerVsize - tx.feePerVsize) >= 0.1)); this.hasEffectiveFeeRate = hasRelatives || (tx.effectiveFeePerVsize && tx.effectiveFeePerVsize !== (this.tx.fee / (this.tx.weight / 4)) && tx.effectiveFeePerVsize !== (tx.fee / Math.ceil(tx.weight / 4)));
} else { } else {
this.fetchCpfp$.next(this.tx.txid); this.fetchCpfp$.next(this.tx.txid);
} }
@ -831,8 +831,8 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
this.sigops = this.cpfpInfo.sigops; this.sigops = this.cpfpInfo.sigops;
this.adjustedVsize = this.cpfpInfo.adjustedVsize; this.adjustedVsize = this.cpfpInfo.adjustedVsize;
} }
this.hasCpfp =!!(this.cpfpInfo && (this.cpfpInfo.bestDescendant || this.cpfpInfo.descendants?.length || this.cpfpInfo.ancestors?.length)); this.hasCpfp =!!(this.cpfpInfo && relatives.length);
this.hasEffectiveFeeRate = hasRelatives || (this.tx.effectiveFeePerVsize && (Math.abs(this.tx.effectiveFeePerVsize - this.tx.feePerVsize) > 0.01)); this.hasEffectiveFeeRate = hasRelatives || (this.tx.effectiveFeePerVsize && this.tx.effectiveFeePerVsize !== (this.tx.fee / (this.tx.weight / 4)) && this.tx.effectiveFeePerVsize !== (this.tx.fee / Math.ceil(this.tx.weight / 4)));
} }
setIsAccelerated(initialState: boolean = false) { setIsAccelerated(initialState: boolean = false) {

View File

@ -17,6 +17,7 @@ export interface Transaction {
feePerVsize?: number; feePerVsize?: number;
effectiveFeePerVsize?: number; effectiveFeePerVsize?: number;
ancestors?: Ancestor[]; ancestors?: Ancestor[];
descendants?: Ancestor[];
bestDescendant?: BestDescendant | null; bestDescendant?: BestDescendant | null;
cpfpChecked?: boolean; cpfpChecked?: boolean;
acceleration?: boolean; acceleration?: boolean;