diff --git a/backend/src/api/common.ts b/backend/src/api/common.ts index 45c7ffe40..e1021c234 100644 --- a/backend/src/api/common.ts +++ b/backend/src/api/common.ts @@ -13,9 +13,13 @@ export class Common { } static percentile(numbers: number[], percentile: number) { - if (percentile === 50) return this.median(numbers); + if (percentile === 50) { + return this.median(numbers); + } const index = Math.ceil(numbers.length * (100 - percentile) * 1e-2); - if (index < 0 || index > numbers.length - 1) return 0; + if (index < 0 || index > numbers.length - 1) { + return 0; + } return numbers[index]; } @@ -71,7 +75,7 @@ export class Common { }, ms); }); } - + static shuffleArray(array: any[]) { for (let i = array.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); @@ -81,7 +85,7 @@ export class Common { static setRelativesAndGetCpfpInfo(tx: TransactionExtended, memPool: { [txid: string]: TransactionExtended }): CpfpInfo { const parents = this.findAllParents(tx, memPool); - const lowerFeeParents = parents.filter((parent) => parent.feePerVsize < tx.feePerVsize); + const lowerFeeParents = parents.filter((parent) => parent.feePerVsize < tx.effectiveFeePerVsize); let totalWeight = tx.weight + lowerFeeParents.reduce((prev, val) => prev + val.weight, 0); let totalFees = tx.fee + lowerFeeParents.reduce((prev, val) => prev + val.fee, 0); diff --git a/backend/src/api/mempool-blocks.ts b/backend/src/api/mempool-blocks.ts index c52c458e9..a9c91103d 100644 --- a/backend/src/api/mempool-blocks.ts +++ b/backend/src/api/mempool-blocks.ts @@ -53,7 +53,7 @@ class MempoolBlocks { // Pass down size + fee to all unconfirmed children let sizes = 0; memPoolArray.forEach((tx, i) => { - sizes += tx.weight + sizes += tx.weight; if (sizes > 4000000 * 8) { return; }