@@ -151,8 +151,9 @@ class Cluster
151
151
/* * Process elements from the front of args that apply to this cluster, and append Refs for the
152
152
* union of their descendants to output. */
153
153
void GetDescendantRefs (const TxGraphImpl& graph, std::span<std::pair<Cluster*, DepGraphIndex>>& args, std::vector<TxGraph::Ref*>& output) noexcept ;
154
- /* * Get a vector of Refs for all elements of this Cluster, in linearization order. */
155
- std::vector<TxGraph::Ref*> GetClusterRefs (const TxGraphImpl& graph) noexcept ;
154
+ /* * Populate range with refs for the transactions in this Cluster's linearization, from
155
+ * position start_pos until start_pos+range.size()-1, inclusive. */
156
+ void GetClusterRefs (TxGraphImpl& graph, std::span<TxGraph::Ref*> range, LinearizationIndex start_pos) noexcept ;
156
157
/* * Get the individual transaction feerate of a Cluster element. */
157
158
FeePerWeight GetIndividualFeerate (DepGraphIndex idx) noexcept ;
158
159
/* * Modify the fee of a Cluster element. */
@@ -1632,17 +1633,16 @@ void Cluster::GetDescendantRefs(const TxGraphImpl& graph, std::span<std::pair<Cl
1632
1633
}
1633
1634
}
1634
1635
1635
- std::vector <TxGraph::Ref*> Cluster::GetClusterRefs ( const TxGraphImpl& graph ) noexcept
1636
+ void Cluster::GetClusterRefs (TxGraphImpl& graph, std::span <TxGraph::Ref*> range, LinearizationIndex start_pos ) noexcept
1636
1637
{
1637
- std::vector<TxGraph::Ref*> ret;
1638
- ret. reserve (m_linearization. size ());
1639
- // Translate all transactions in the Cluster (in linearization order) to Refs.
1640
- for ( auto idx : m_linearization) {
1641
- const auto & entry = graph.m_entries [m_mapping[idx ]];
1638
+ // Translate the transactions in the Cluster (in linearization order, starting at start_pos in
1639
+ // the linearization) to Refs, and fill them in range.
1640
+ for ( auto & ref : range) {
1641
+ Assume (start_pos < m_linearization. size ());
1642
+ const auto & entry = graph.m_entries [m_mapping[m_linearization[start_pos++] ]];
1642
1643
Assume (entry.m_ref != nullptr );
1643
- ret. push_back ( entry.m_ref ) ;
1644
+ ref = entry.m_ref ;
1644
1645
}
1645
- return ret;
1646
1646
}
1647
1647
1648
1648
FeePerWeight Cluster::GetIndividualFeerate (DepGraphIndex idx) noexcept
@@ -1786,7 +1786,9 @@ std::vector<TxGraph::Ref*> TxGraphImpl::GetCluster(const Ref& arg, bool main_onl
1786
1786
if (cluster == nullptr ) return {};
1787
1787
// Make sure the Cluster has an acceptable quality level, and then dispatch to it.
1788
1788
MakeAcceptable (*cluster);
1789
- return cluster->GetClusterRefs (*this );
1789
+ std::vector<TxGraph::Ref*> ret (cluster->GetTxCount ());
1790
+ cluster->GetClusterRefs (*this , ret, 0 );
1791
+ return ret;
1790
1792
}
1791
1793
1792
1794
TxGraph::GraphIndex TxGraphImpl::GetTransactionCount (bool main_only) noexcept
0 commit comments