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

Method GetMainStagingDiagrams

src/txgraph.cpp:2810–2834  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2808}
2809
2810std::pair<std::vector<FeeFrac>, std::vector<FeeFrac>> TxGraphImpl::GetMainStagingDiagrams() noexcept
2811{
2812 Assume(m_staging_clusterset.has_value());
2813 MakeAllAcceptable(0);
2814 Assume(m_main_clusterset.m_deps_to_add.empty()); // can only fail if main is oversized
2815 MakeAllAcceptable(1);
2816 Assume(m_staging_clusterset->m_deps_to_add.empty()); // can only fail if staging is oversized
2817 // For all Clusters in main which conflict with Clusters in staging (i.e., all that are removed
2818 // by, or replaced in, staging), gather their chunk feerates.
2819 auto main_clusters = GetConflicts();
2820 std::vector<FeeFrac> main_feerates, staging_feerates;
2821 for (Cluster* cluster : main_clusters) {
2822 cluster->AppendChunkFeerates(main_feerates);
2823 }
2824 // Do the same for the Clusters in staging themselves.
2825 for (int quality = 0; quality < int(QualityLevel::NONE); ++quality) {
2826 for (const auto& cluster : m_staging_clusterset->m_clusters[quality]) {
2827 cluster->AppendChunkFeerates(staging_feerates);
2828 }
2829 }
2830 // Sort both by decreasing feerate to obtain diagrams, and return them.
2831 std::ranges::sort(main_feerates, std::greater<ByRatioNegSize<FeeFrac>>{});
2832 std::ranges::sort(staging_feerates, std::greater<ByRatioNegSize<FeeFrac>>{});
2833 return std::make_pair(std::move(main_feerates), std::move(staging_feerates));
2834}
2835
2836void GenericClusterImpl::SanityCheck(const TxGraphImpl& graph, int level) const
2837{

Callers 2

CalculateChunksForRBFMethod · 0.80
FUZZ_TARGETFunction · 0.80

Calls 3

AppendChunkFeeratesMethod · 0.80
has_valueMethod · 0.45
emptyMethod · 0.45

Tested by 1

FUZZ_TARGETFunction · 0.64