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

Method FindClusterAndLevel

src/txgraph.cpp:1675–1691  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1673}
1674
1675std::pair<Cluster*, int> TxGraphImpl::FindClusterAndLevel(GraphIndex idx, int level) const noexcept
1676{
1677 Assume(level >= 0 && level <= GetTopLevel());
1678 auto& entry = m_entries[idx];
1679 // Search the entry's locators from top to bottom.
1680 for (int l = level; l >= 0; --l) {
1681 // If the locator is missing, dig deeper; it may exist at a lower level and therefore be
1682 // implicitly existing at this level too.
1683 if (entry.m_locator[l].IsMissing()) continue;
1684 // If the locator has the entry marked as explicitly removed, stop.
1685 if (entry.m_locator[l].IsRemoved()) break;
1686 // Otherwise, we have found the topmost ClusterSet that contains this entry.
1687 return {entry.m_locator[l].cluster, l};
1688 }
1689 // If no non-empty locator was found, or an explicitly removed was hit, return nothing.
1690 return {nullptr, -1};
1691}
1692
1693Cluster* TxGraphImpl::PullIn(Cluster* cluster, int level) noexcept
1694{

Callers

nothing calls this directly

Calls 2

IsMissingMethod · 0.80
IsRemovedMethod · 0.80

Tested by

no test coverage detected