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

Method GetCluster

src/txgraph.cpp:2536–2555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2534}
2535
2536std::vector<TxGraph::Ref*> TxGraphImpl::GetCluster(const Ref& arg, Level level_select) noexcept
2537{
2538 // Return the empty vector if the Ref is empty (which may be indicative of the transaction
2539 // having been removed already.
2540 if (GetRefGraph(arg) == nullptr) return {};
2541 Assume(GetRefGraph(arg) == this);
2542 // Apply all removals and dependencies, as the result might be incorrect otherwise.
2543 size_t level = GetSpecifiedLevel(level_select);
2544 ApplyDependencies(level);
2545 // Cluster linearization cannot be known if unapplied dependencies remain.
2546 Assume(GetClusterSet(level).m_deps_to_add.empty());
2547 // Find the Cluster the argument is in, and return the empty vector if it isn't in any.
2548 auto [cluster, cluster_level] = FindClusterAndLevel(GetRefIndex(arg), level);
2549 if (cluster == nullptr) return {};
2550 // Make sure the Cluster has an acceptable quality level, and then dispatch to it.
2551 MakeAcceptable(*cluster, cluster_level);
2552 std::vector<TxGraph::Ref*> ret(cluster->GetTxCount());
2553 cluster->GetClusterRefs(*this, ret, 0);
2554 return ret;
2555}
2556
2557TxGraph::GraphIndex TxGraphImpl::GetTransactionCount(Level level_select) noexcept
2558{

Callers 5

GatherClustersMethod · 0.80
FUZZ_TARGETFunction · 0.80
getmempoolclusterFunction · 0.80

Calls 3

GetClusterRefsMethod · 0.80
emptyMethod · 0.45
GetTxCountMethod · 0.45

Tested by 1

FUZZ_TARGETFunction · 0.64