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

Method GetLevel

src/txgraph.cpp:996–1011  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

994}
995
996int GenericClusterImpl::GetLevel(const TxGraphImpl& graph) const noexcept
997{
998 // GetLevel() does not work for empty Clusters.
999 if (!Assume(!m_linearization.empty())) return -1;
1000
1001 // Pick an arbitrary Entry that occurs in this Cluster.
1002 const auto& entry = graph.m_entries[m_mapping[m_linearization.front()]];
1003 // See if there is a level whose Locator matches this Cluster, if so return that level.
1004 for (int level = 0; level < MAX_LEVELS; ++level) {
1005 if (entry.m_locator[level].cluster == this) return level;
1006 }
1007 // Given that we started with an Entry that occurs in this Cluster, one of its Locators must
1008 // point back to it.
1009 assert(false);
1010 return -1;
1011}
1012
1013int SingletonClusterImpl::GetLevel(const TxGraphImpl& graph) const noexcept
1014{

Callers 3

ApplyDependenciesMethod · 0.80
SanityCheckMethod · 0.80
TrimMethod · 0.80

Calls 2

emptyMethod · 0.45
frontMethod · 0.45

Tested by

no test coverage detected