Merge pull request #419 from mempool/simon/cpfp-duplicate-fix

Fix for duplicate cpfp ancestors.
This commit is contained in:
wiz 2021-04-06 15:58:58 +09:00 committed by GitHub
commit 0f9f905fd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,6 +114,10 @@ export class Common {
private static findAllParents(tx: TransactionExtended, memPool: { [txid: string]: TransactionExtended }): TransactionExtended[] { private static findAllParents(tx: TransactionExtended, memPool: { [txid: string]: TransactionExtended }): TransactionExtended[] {
let parents: TransactionExtended[] = []; let parents: TransactionExtended[] = [];
tx.vin.forEach((parent) => { tx.vin.forEach((parent) => {
if (parents.find((p) => p.txid === parent.txid)) {
return;
}
const parentTx = memPool[parent.txid]; const parentTx = memPool[parent.txid];
if (parentTx) { if (parentTx) {
if (tx.bestDescendant && tx.bestDescendant.fee / (tx.bestDescendant.weight / 4) > parentTx.feePerVsize) { if (tx.bestDescendant && tx.bestDescendant.fee / (tx.bestDescendant.weight / 4) > parentTx.feePerVsize) {