mirror of
https://github.com/mempool/mempool.git
synced 2025-03-13 11:36:07 +01:00
When filtering out lower fee parents, compare with effective fee instead of base fee to include a CPFP chain of transactions.
This commit is contained in:
parent
c7c4895eab
commit
2d9b9b5c5d
2 changed files with 9 additions and 5 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue