Skip to content

Commit

Permalink
fix tx mempool with ascendents from disconnected block
Browse files Browse the repository at this point in the history
  • Loading branch information
alex v committed Jul 26, 2024
1 parent d52e513 commit 74bac15
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/blsct/wallet/txfactory_global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,30 @@ CTransactionRef AggregateTransactions(const std::vector<CTransactionRef>& txs)
std::vector<Signature> vSigs;
CAmount nFee = 0;

std::set<Txid> setHashes;
std::set<Txid> setNoAscendents;

for (auto& tx : txs) {
setHashes.insert(tx->GetHash());
}

for (auto& tx : txs) {
bool fDependsOnOther = false;
for (auto& in : tx->vin) {
if (setHashes.find(in.prevout.hash) != setHashes.end()) {
fDependsOnOther = true;
break;
}
}
if (!fDependsOnOther)
setNoAscendents.insert(tx->GetHash());
}

for (auto& tx : txs) {
if (setNoAscendents.find(tx->GetHash()) != setNoAscendents.end()) {
continue;
}

vSigs.push_back(tx->txSig);
for (auto& in : tx->vin) {
ret.vin.push_back(in);
Expand Down

0 comments on commit 74bac15

Please sign in to comment.