Merge pull request #3834 from mempool/mononaut/fix-double-mined-rbf

Fix multiple mined RBF replacements of the same tx
This commit is contained in:
softsimon 2023-06-14 22:15:53 +02:00 committed by GitHub
commit a99515e94a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,6 +91,14 @@ export class Common {
if (replaced.size) {
matches[tx.txid] = { replaced: Array.from(replaced), replacedBy: tx };
}
// remove this tx from the spendMap
// prevents the same tx being replaced more than once
for (const vin of tx.vin) {
const key = `${vin.txid}:${vin.vout}`;
if (spendMap.get(key)?.txid === tx.txid) {
spendMap.delete(key);
}
}
}
return matches;
}