show cpfp badges on non-mempool tx previews
This commit is contained in:
parent
fa515402bf
commit
3e7270d1c5
@ -8,10 +8,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div *ngIf="network !== 'liquid' && network !== 'liquidtestnet'" class="features">
|
<div *ngIf="network !== 'liquid' && network !== 'liquidtestnet'" class="features">
|
||||||
<app-tx-features [tx]="tx"></app-tx-features>
|
<app-tx-features [tx]="tx"></app-tx-features>
|
||||||
<span *ngIf="cpfpInfo && cpfpInfo.bestDescendant" class="badge badge-primary mr-1">
|
<span *ngIf="cpfpInfo && (cpfpInfo.bestDescendant || cpfpInfo.descendants.length)" class="badge badge-primary mr-1">
|
||||||
CPFP
|
CPFP
|
||||||
</span>
|
</span>
|
||||||
<span *ngIf="cpfpInfo && !cpfpInfo.bestDescendant && cpfpInfo.ancestors.length" class="badge badge-info mr-1">
|
<span *ngIf="cpfpInfo && !cpfpInfo.bestDescendant && !cpfpInfo.descendants.length && cpfpInfo.ancestors.length" class="badge badge-info mr-1">
|
||||||
CPFP
|
CPFP
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -72,25 +72,31 @@ export class TransactionPreviewComponent implements OnInit, OnDestroy {
|
|||||||
if (!this.tx) {
|
if (!this.tx) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const lowerFeeParents = cpfpInfo.ancestors.filter(
|
if (cpfpInfo.effectiveFeePerVsize) {
|
||||||
(parent) => parent.fee / (parent.weight / 4) < this.tx.feePerVsize
|
this.tx.effectiveFeePerVsize = cpfpInfo.effectiveFeePerVsize;
|
||||||
);
|
} else {
|
||||||
let totalWeight =
|
const lowerFeeParents = cpfpInfo.ancestors.filter(
|
||||||
this.tx.weight +
|
(parent) => parent.fee / (parent.weight / 4) < this.tx.feePerVsize
|
||||||
lowerFeeParents.reduce((prev, val) => prev + val.weight, 0);
|
);
|
||||||
let totalFees =
|
let totalWeight =
|
||||||
this.tx.fee +
|
this.tx.weight +
|
||||||
lowerFeeParents.reduce((prev, val) => prev + val.fee, 0);
|
lowerFeeParents.reduce((prev, val) => prev + val.weight, 0);
|
||||||
|
let totalFees =
|
||||||
|
this.tx.fee +
|
||||||
|
lowerFeeParents.reduce((prev, val) => prev + val.fee, 0);
|
||||||
|
|
||||||
if (cpfpInfo.bestDescendant) {
|
if (cpfpInfo?.bestDescendant) {
|
||||||
totalWeight += cpfpInfo.bestDescendant.weight;
|
totalWeight += cpfpInfo?.bestDescendant.weight;
|
||||||
totalFees += cpfpInfo.bestDescendant.fee;
|
totalFees += cpfpInfo?.bestDescendant.fee;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.tx.effectiveFeePerVsize = totalFees / (totalWeight / 4);
|
||||||
|
}
|
||||||
|
if (!this.tx.status.confirmed) {
|
||||||
|
this.stateService.markBlock$.next({
|
||||||
|
txFeePerVSize: this.tx.effectiveFeePerVsize,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tx.effectiveFeePerVsize = totalFees / (totalWeight / 4);
|
|
||||||
this.stateService.markBlock$.next({
|
|
||||||
txFeePerVSize: this.tx.effectiveFeePerVsize,
|
|
||||||
});
|
|
||||||
this.cpfpInfo = cpfpInfo;
|
this.cpfpInfo = cpfpInfo;
|
||||||
this.openGraphService.waitOver('cpfp-data-' + this.txId);
|
this.openGraphService.waitOver('cpfp-data-' + this.txId);
|
||||||
});
|
});
|
||||||
@ -176,8 +182,17 @@ export class TransactionPreviewComponent implements OnInit, OnDestroy {
|
|||||||
this.getTransactionTime();
|
this.getTransactionTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.tx.status.confirmed) {
|
if (this.tx.status.confirmed) {
|
||||||
|
this.stateService.markBlock$.next({
|
||||||
|
blockHeight: tx.status.block_height,
|
||||||
|
});
|
||||||
|
this.openGraphService.waitFor('cpfp-data-' + this.txId);
|
||||||
|
this.fetchCpfp$.next(this.tx.txid);
|
||||||
|
} else {
|
||||||
if (tx.cpfpChecked) {
|
if (tx.cpfpChecked) {
|
||||||
|
this.stateService.markBlock$.next({
|
||||||
|
txFeePerVSize: tx.effectiveFeePerVsize,
|
||||||
|
});
|
||||||
this.cpfpInfo = {
|
this.cpfpInfo = {
|
||||||
ancestors: tx.ancestors,
|
ancestors: tx.ancestors,
|
||||||
bestDescendant: tx.bestDescendant,
|
bestDescendant: tx.bestDescendant,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user