| 2534 | } |
| 2535 | |
| 2536 | std::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 | |
| 2557 | TxGraph::GraphIndex TxGraphImpl::GetTransactionCount(Level level_select) noexcept |
| 2558 | { |