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

Function ChunkLinearization

src/cluster_linearize.h:449–464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447 * only returns the chunk feerates, not the corresponding transaction sets. */
448template<typename SetType>
449std::vector<FeeFrac> ChunkLinearization(const DepGraph<SetType>& depgraph, std::span<const DepGraphIndex> linearization) noexcept
450{
451 std::vector<FeeFrac> ret;
452 for (DepGraphIndex i : linearization) {
453 /** The new chunk to be added, initially a singleton. */
454 auto new_chunk = depgraph.FeeRate(i);
455 // As long as the new chunk has a higher feerate than the last chunk so far, absorb it.
456 while (!ret.empty() && ByRatio{new_chunk} > ByRatio{ret.back()}) {
457 new_chunk += ret.back();
458 ret.pop_back();
459 }
460 // Actually move that new chunk into the chunking.
461 ret.push_back(std::move(new_chunk));
462 }
463 return ret;
464}
465
466/** Concept for function objects that return std::strong_ordering when invoked with two Args. */
467template<typename F, typename Arg>

Callers 4

AppendChunkFeeratesMethod · 0.85
FUZZ_TARGETFunction · 0.85
ExhaustiveLinearizeFunction · 0.85
FUZZ_TARGETFunction · 0.85

Calls 5

FeeRateMethod · 0.80
emptyMethod · 0.45
backMethod · 0.45
pop_backMethod · 0.45
push_backMethod · 0.45

Tested by 3

FUZZ_TARGETFunction · 0.68
ExhaustiveLinearizeFunction · 0.68
FUZZ_TARGETFunction · 0.68