5#ifndef BITCOIN_TEST_UTIL_CLUSTER_LINEARIZE_H
6#define BITCOIN_TEST_UTIL_CLUSTER_LINEARIZE_H
99struct DepGraphFormatter
121 template <
typename Stream,
typename SetType>
129 auto anc_a = depgraph.Ancestors(a).Count(), anc_b = depgraph.Ancestors(b).Count();
130 if (anc_a != anc_b) return anc_a < anc_b;
170 auto skips = (done - SetType::Fill(idx)).Count();
186 template <
typename Stream,
typename SetType>
209 static_assert(0x3FFFFF >= 4000000);
210 if (size == 0 ||
topo_depgraph.TxCount() == SetType::Size())
break;
215 static_assert(0xFFFFFFFFFFFFF >
uint64_t{2} * 21000000 * 100000000);
235 }
catch (
const std::ios_base::failure&) {
246 diff %= SetType::Size();
265 SetType
holes = SetType::Fill(SetType::Size());
267 for (
auto pos :
holes) {
285template<
typename SetType>
314 auto parents =
depgraph.GetReducedParents(i);
315 auto children =
depgraph.GetReducedChildren(i);
320 for (
auto parent : parents) {
321 assert((
depgraph.Ancestors(parent) & parents).IsSubsetOf(SetType::Singleton(parent)));
324 for (
auto child : children) {
330 std::vector<unsigned char>
ser;
350 std::vector<SetType> parents(
depgraph.PositionRange()), children(
depgraph.PositionRange());
352 parents[i] =
depgraph.GetReducedParents(i);
353 children[i] =
depgraph.GetReducedChildren(i);
355 for (
auto i :
depgraph.Positions()) {
357 SetType ancestors = SetType::Singleton(i);
361 for (
auto j : ancestors) ancestors |= parents[
j];
368 SetType descendants = SetType::Singleton(i);
372 for (
auto j : descendants) descendants |= children[
j];
382template<
typename SetType>
405 0, 545, 928, 1633, 2647, 4065, 5598, 8258,
406 9505, 11471, 14137, 19553, 20460, 26191, 28397, 32599,
407 41631, 47419, 56329, 57767, 72196, 63652, 95366, 96537,
408 115653, 125407, 131734, 145090, 156349, 164665, 194224, 203953,
409 207710, 225878, 239971, 252284, 256534, 222142, 251332, 357098,
410 325788, 295867, 410053, 497483, 533892, 576572, 577845, 572400,
411 592536, 455082, 609249, 659130, 714091, 544507, 718788, 562378,
412 601926, 1025081, 732725, 708896, 738224, 900445, 1092519, 1139946
416 return COSTS[cluster_count] * 2;
std::conditional_t<(BITS<=32), bitset_detail::IntBitSet< uint32_t >, std::conditional_t<(BITS<=std::numeric_limits< size_t >::digits), bitset_detail::IntBitSet< size_t >, bitset_detail::MultiIntBitSet< size_t,(BITS+std::numeric_limits< size_t >::digits - 1)/std::numeric_limits< size_t >::digits > > > BitSet
Minimal stream for reading from an existing byte array by std::span.
Data structure that holds a transaction graph's preprocessed data (fee, size, ancestors,...
uint32_t DepGraphIndex
Data type to represent transaction indices in DepGraphs and the clusters they represent.
#define VARINT_MODE(obj, mode)
Data structure storing a fee and size, ordered by increasing fee/size.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.