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

Method GetConnectedComponent

src/cluster_linearize.h:266–282  ·  view source on GitHub ↗

Get the connected component within the subset "todo" that contains tx (which must be in * todo). * * Two transactions are considered connected if they are both in `todo`, and one is an ancestor * of the other in the entire graph (so not just within `todo`), or transitively there is a * path of transactions connecting them. This does mean that if `todo` contains a transact

Source from the content-addressed store, hash-verified

264 * Complexity: O(ret.Count()).
265 */
266 SetType GetConnectedComponent(const SetType& todo, DepGraphIndex tx) const noexcept
267 {
268 Assume(todo[tx]);
269 Assume(todo.IsSubsetOf(m_used));
270 auto to_add = SetType::Singleton(tx);
271 SetType ret;
272 do {
273 SetType old = ret;
274 for (auto add : to_add) {
275 ret |= Descendants(add);
276 ret |= Ancestors(add);
277 }
278 ret &= todo;
279 to_add = ret - old;
280 } while (to_add.Any());
281 return ret;
282 }
283
284 /** Find some connected component within the subset "todo" of this graph.
285 *

Callers 3

MakeModifiedMethod · 0.80
FUZZ_TARGETFunction · 0.80
FUZZ_TARGETFunction · 0.80

Calls 2

IsSubsetOfMethod · 0.45
AnyMethod · 0.45

Tested by 3

MakeModifiedMethod · 0.64
FUZZ_TARGETFunction · 0.64
FUZZ_TARGETFunction · 0.64