Skip to content

Commit

Permalink
check mempool parents
Browse files Browse the repository at this point in the history
  • Loading branch information
alex v committed Jul 27, 2024
1 parent 0c1e73f commit b44e0a7
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions src/node/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,29 +231,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBLSCTBlock(const blsct:
addPackageTxs(*m_mempool, nPackagesSelected, nDescendantsUpdated);
}

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

for (auto& tx : txns) {
setHashes.insert(tx.GetHash());
}

for (auto& tx : txns) {
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 (const CMutableTransaction& tx : txns) {
if (setNoAscendents.find(tx.GetHash()) != setNoAscendents.end()) {
continue;
}
for (auto& out : tx.vout) {
if (out.scriptPubKey.IsFee()) {
nFees += out.nValue;
Expand Down Expand Up @@ -360,6 +338,7 @@ bool BlockAssembler::TestPackageTransactions(const CTxMemPool::setEntries& packa

void BlockAssembler::AddToBlock(CTxMemPool::txiter iter)
{
if (iter->GetTx().IsBLSCT() && iter->GetMemPoolParents().size() > 0) return;
pblocktemplate->block.vtx.emplace_back(iter->GetSharedTx());
pblocktemplate->vTxFees.push_back(iter->GetFee());
pblocktemplate->vTxSigOpsCost.push_back(iter->GetSigOpCost());
Expand Down

0 comments on commit b44e0a7

Please sign in to comment.