@@ -428,6 +428,8 @@ class TxGraphImpl final : public TxGraph
428428 void ApplyDependencies (int level) noexcept ;
429429 /* * Make a specified Cluster have quality ACCEPTABLE or OPTIMAL. */
430430 void MakeAcceptable (Cluster& cluster) noexcept ;
431+ /* * Make all Clusters at the specified level have quality ACCEPTABLE or OPTIMAL. */
432+ void MakeAllAcceptable (int level) noexcept ;
431433
432434 // Implementations for the public TxGraph interface.
433435
@@ -436,6 +438,8 @@ class TxGraphImpl final : public TxGraph
436438 void AddDependency (const Ref& parent, const Ref& child) noexcept final ;
437439 void SetTransactionFee (const Ref&, int64_t fee) noexcept final ;
438440
441+ void DoWork () noexcept final ;
442+
439443 void StartStaging () noexcept final ;
440444 void CommitStaging () noexcept final ;
441445 void AbortStaging () noexcept final ;
@@ -1370,6 +1374,17 @@ void TxGraphImpl::MakeAcceptable(Cluster& cluster) noexcept
13701374 }
13711375}
13721376
1377+ void TxGraphImpl::MakeAllAcceptable (int level) noexcept
1378+ {
1379+ ApplyDependencies (level);
1380+ auto & clusterset = GetClusterSet (level);
1381+ if (clusterset.m_oversized == true ) return ;
1382+ auto & queue = clusterset.m_clusters [int (QualityLevel::NEEDS_RELINEARIZE)];
1383+ while (!queue.empty ()) {
1384+ MakeAcceptable (*queue.back ().get ());
1385+ }
1386+ }
1387+
13731388Cluster::Cluster (TxGraphImpl& graph, const FeePerWeight& feerate, GraphIndex graph_index) noexcept
13741389{
13751390 // Create a new transaction in the DepGraph, and remember its position in m_mapping.
@@ -1942,6 +1957,13 @@ void TxGraphImpl::SanityCheck() const
19421957 }
19431958}
19441959
1960+ void TxGraphImpl::DoWork () noexcept
1961+ {
1962+ for (int level = 0 ; level <= GetTopLevel (); ++level) {
1963+ MakeAllAcceptable (level);
1964+ }
1965+ }
1966+
19451967} // namespace
19461968
19471969TxGraph::Ref::~Ref ()
0 commit comments