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

Method GetDescendants

src/txgraph.cpp:2449–2468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2447}
2448
2449std::vector<TxGraph::Ref*> TxGraphImpl::GetDescendants(const Ref& arg, Level level_select) noexcept
2450{
2451 // Return the empty vector if the Ref is empty.
2452 if (GetRefGraph(arg) == nullptr) return {};
2453 Assume(GetRefGraph(arg) == this);
2454 // Apply all removals and dependencies, as the result might be incorrect otherwise.
2455 size_t level = GetSpecifiedLevel(level_select);
2456 ApplyDependencies(level);
2457 // Ancestry cannot be known if unapplied dependencies remain.
2458 Assume(GetClusterSet(level).m_deps_to_add.empty());
2459 // Find the Cluster the argument is in, and return the empty vector if it isn't in any.
2460 auto [cluster, cluster_level] = FindClusterAndLevel(GetRefIndex(arg), level);
2461 if (cluster == nullptr) return {};
2462 // Dispatch to the Cluster.
2463 std::pair<Cluster*, DepGraphIndex> match = {cluster, m_entries[GetRefIndex(arg)].m_locator[cluster_level].index};
2464 auto matches = std::span(&match, 1);
2465 std::vector<TxGraph::Ref*> ret;
2466 cluster->GetDescendantRefs(*this, matches, ret);
2467 return ret;
2468}
2469
2470std::vector<TxGraph::Ref*> TxGraphImpl::GetAncestorsUnion(std::span<const Ref* const> args, Level level_select) noexcept
2471{

Callers 6

GetDescendantCountMethod · 0.80
HasDescendantsMethod · 0.80
CalculateDescendantsMethod · 0.80
removeRecursiveMethod · 0.80
FUZZ_TARGETFunction · 0.80

Calls 2

GetDescendantRefsMethod · 0.80
emptyMethod · 0.45

Tested by 1

FUZZ_TARGETFunction · 0.64