Fix for duplicate cpfp ancestors.

fixes #414
This commit is contained in:
softsimon 2021-04-02 00:30:51 +04:00
parent 2b1c511611
commit 4d0429b786
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7

View File

@ -113,6 +113,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) {