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

Method AddDependency

src/txgraph.cpp:2281–2303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2279}
2280
2281void TxGraphImpl::AddDependency(const Ref& parent, const Ref& child) noexcept
2282{
2283 // Don't do anything if either Ref is empty (which may be indicative of it having already been
2284 // removed).
2285 if (GetRefGraph(parent) == nullptr || GetRefGraph(child) == nullptr) return;
2286 Assume(GetRefGraph(parent) == this && GetRefGraph(child) == this);
2287 Assume(m_main_chunkindex_observers == 0 || GetTopLevel() != 0);
2288 // Don't do anything if this is a dependency on self.
2289 if (GetRefIndex(parent) == GetRefIndex(child)) return;
2290 // Find the Cluster the parent and child transaction are in, and stop if either appears to be
2291 // already removed.
2292 int level = GetTopLevel();
2293 auto par_cluster = FindCluster(GetRefIndex(parent), level);
2294 if (par_cluster == nullptr) return;
2295 auto chl_cluster = FindCluster(GetRefIndex(child), level);
2296 if (chl_cluster == nullptr) return;
2297 // Remember that this dependency is to be applied.
2298 auto& clusterset = GetClusterSet(level);
2299 clusterset.m_deps_to_add.emplace_back(GetRefIndex(parent), GetRefIndex(child));
2300 // Wipe m_group_data (as it will need to be recomputed).
2301 clusterset.m_group_data.reset();
2302 if (clusterset.m_oversized == false) clusterset.m_oversized = std::nullopt;
2303}
2304
2305bool TxGraphImpl::Exists(const Ref& arg, Level level_select) noexcept
2306{

Callers 2

ProcessDependenciesMethod · 0.45

Calls 2

emplace_backMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected