remove redundant fields from CPFP interfaces
This commit is contained in:
parent
01c96f80f9
commit
fcd047f302
@ -83,7 +83,6 @@ class TransactionRepository {
|
|||||||
return {
|
return {
|
||||||
descendants,
|
descendants,
|
||||||
ancestors,
|
ancestors,
|
||||||
effectiveFeePerVsize: cpfp.fee_rate
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,26 +131,17 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
this.cpfpInfo = null;
|
this.cpfpInfo = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (cpfpInfo.effectiveFeePerVsize) {
|
|
||||||
this.tx.effectiveFeePerVsize = cpfpInfo.effectiveFeePerVsize;
|
|
||||||
} else {
|
|
||||||
const lowerFeeParents = cpfpInfo.ancestors.filter(
|
|
||||||
(parent) => parent.fee / (parent.weight / 4) < this.tx.feePerVsize
|
|
||||||
);
|
|
||||||
let totalWeight =
|
|
||||||
this.tx.weight +
|
|
||||||
lowerFeeParents.reduce((prev, val) => prev + val.weight, 0);
|
|
||||||
let totalFees =
|
|
||||||
this.tx.fee +
|
|
||||||
lowerFeeParents.reduce((prev, val) => prev + val.fee, 0);
|
|
||||||
|
|
||||||
if (cpfpInfo?.bestDescendant) {
|
const relatives = [...cpfpInfo.ancestors, ...cpfpInfo.descendants || [cpfpInfo.bestDescendant]];
|
||||||
totalWeight += cpfpInfo?.bestDescendant.weight;
|
let totalWeight =
|
||||||
totalFees += cpfpInfo?.bestDescendant.fee;
|
this.tx.weight +
|
||||||
}
|
relatives.reduce((prev, val) => prev + val.weight, 0);
|
||||||
|
let totalFees =
|
||||||
|
this.tx.fee +
|
||||||
|
relatives.reduce((prev, val) => prev + val.fee, 0);
|
||||||
|
|
||||||
|
this.tx.effectiveFeePerVsize = totalFees / (totalWeight / 4);
|
||||||
|
|
||||||
this.tx.effectiveFeePerVsize = totalFees / (totalWeight / 4);
|
|
||||||
}
|
|
||||||
if (!this.tx.status.confirmed) {
|
if (!this.tx.status.confirmed) {
|
||||||
this.stateService.markBlock$.next({
|
this.stateService.markBlock$.next({
|
||||||
txFeePerVSize: this.tx.effectiveFeePerVsize,
|
txFeePerVSize: this.tx.effectiveFeePerVsize,
|
||||||
|
@ -24,7 +24,6 @@ export interface CpfpInfo {
|
|||||||
ancestors: Ancestor[];
|
ancestors: Ancestor[];
|
||||||
descendants?: Ancestor[];
|
descendants?: Ancestor[];
|
||||||
bestDescendant?: BestDescendant | null;
|
bestDescendant?: BestDescendant | null;
|
||||||
effectiveFeePerVsize?: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DifficultyAdjustment {
|
export interface DifficultyAdjustment {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user