MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / GatherClusters

Method GatherClusters

src/txmempool.cpp:968–992  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

966}
967
968std::vector<CTxMemPool::txiter> CTxMemPool::GatherClusters(const std::vector<Txid>& txids) const
969{
970 AssertLockHeld(cs);
971
972 std::vector<CTxMemPool::txiter> ret;
973 std::set<const CTxMemPoolEntry*> unique_cluster_representatives;
974 for (auto txid : txids) {
975 auto it = mapTx.find(txid);
976 if (it != mapTx.end()) {
977 // Note that TxGraph::GetCluster will return results in graph
978 // order, which is deterministic (as long as we are not modifying
979 // the graph).
980 auto cluster = m_txgraph->GetCluster(*it, TxGraph::Level::MAIN);
981 if (unique_cluster_representatives.insert(static_cast<const CTxMemPoolEntry*>(&(**cluster.begin()))).second) {
982 for (auto tx : cluster) {
983 ret.emplace_back(mapTx.iterator_to(static_cast<const CTxMemPoolEntry&>(*tx)));
984 }
985 }
986 }
987 }
988 if (ret.size() > 500) {
989 return {};
990 }
991 return ret;
992}
993
994util::Result<std::pair<std::vector<FeeFrac>, std::vector<FeeFrac>>> CTxMemPool::ChangeSet::CalculateChunksForRBF()
995{

Callers 3

BOOST_FIXTURE_TEST_CASEFunction · 0.80
MiniMinerMethod · 0.80

Calls 7

findMethod · 0.80
GetClusterMethod · 0.80
endMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
emplace_backMethod · 0.45
sizeMethod · 0.45

Tested by 2

BOOST_FIXTURE_TEST_CASEFunction · 0.64