Skip to content

Commit

Permalink
Merge branch 'master' into fix/getmasternodeblocks-depth
Browse files Browse the repository at this point in the history
  • Loading branch information
dcorral authored Dec 7, 2021
2 parents a3c3a8e + 5dd54ad commit 334ee3b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ void BlockAssembler::SortForBlock(const CTxMemPool::setEntries& package, std::ve
// transactions for block inclusion.
sortedEntries.clear();
sortedEntries.insert(sortedEntries.begin(), package.begin(), package.end());
std::sort(sortedEntries.begin(), sortedEntries.end(), CompareTxIterByAncestorCount());
std::sort(sortedEntries.begin(), sortedEntries.end(), CompareTxIterByEntryTime());
}

// This transaction selection algorithm orders the mempool based
Expand Down Expand Up @@ -993,4 +993,4 @@ void ThreadStaker::operator()(std::vector<ThreadStaker::Args> args, CChainParams
}
}

}
}
10 changes: 10 additions & 0 deletions src/miner.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ struct CompareTxIterByAncestorCount {
}
};

// A comparator that sorts transactions based on tx entry time.
struct CompareTxIterByEntryTime {
bool operator()(const CTxMemPool::txiter &a, const CTxMemPool::txiter &b) const
{
if (a->GetTime() == b->GetTime())
return CompareTxIterByAncestorCount()(a, b);
return CompareTxMemPoolEntryByEntryTime()(*a, *b);
}
};

typedef boost::multi_index_container<
CTxMemPoolModifiedEntry,
boost::multi_index::indexed_by<
Expand Down

0 comments on commit 334ee3b

Please sign in to comment.