clusterlin: rename Intersect -> IntersectPrefixes

This makes it clearer what the function does.
This commit is contained in:
Pieter Wuille
2024-07-30 16:21:51 -04:00
parent 9774a958b5
commit 0e52728a2d
2 changed files with 7 additions and 7 deletions

View File

@@ -333,12 +333,12 @@ public:
* of the linearization that has a feerate not below subset's. * of the linearization that has a feerate not below subset's.
* *
* This is a crucial operation in guaranteeing improvements to linearizations. If subset has * This is a crucial operation in guaranteeing improvements to linearizations. If subset has
* a feerate not below GetChunk(0)'s, then moving Intersect(subset) to the front of (what * a feerate not below GetChunk(0)'s, then moving IntersectPrefixes(subset) to the front of
* remains of) the linearization is guaranteed not to make it worse at any point. * (what remains of) the linearization is guaranteed not to make it worse at any point.
* *
* See https://delvingbitcoin.org/t/introduction-to-cluster-linearization/1032 for background. * See https://delvingbitcoin.org/t/introduction-to-cluster-linearization/1032 for background.
*/ */
SetInfo<SetType> Intersect(const SetInfo<SetType>& subset) const noexcept SetInfo<SetType> IntersectPrefixes(const SetInfo<SetType>& subset) const noexcept
{ {
Assume(subset.transactions.IsSubsetOf(m_todo)); Assume(subset.transactions.IsSubsetOf(m_todo));
SetInfo<SetType> accumulator; SetInfo<SetType> accumulator;
@@ -719,7 +719,7 @@ std::pair<std::vector<ClusterIndex>, bool> Linearize(const DepGraph<SetType>& de
// sure we don't pick something that makes us unable to reach further diagram points // sure we don't pick something that makes us unable to reach further diagram points
// of the old linearization. // of the old linearization.
if (old_chunking.NumChunksLeft() > 0) { if (old_chunking.NumChunksLeft() > 0) {
best = old_chunking.Intersect(best); best = old_chunking.IntersectPrefixes(best);
} }
} }

View File

@@ -560,10 +560,10 @@ FUZZ_TARGET(clusterlin_linearization_chunking)
} }
assert(combined == todo); assert(combined == todo);
// Verify the expected properties of LinearizationChunking::Intersect: // Verify the expected properties of LinearizationChunking::IntersectPrefixes:
auto intersect = chunking.Intersect(subset); auto intersect = chunking.IntersectPrefixes(subset);
// - Intersecting again doesn't change the result. // - Intersecting again doesn't change the result.
assert(chunking.Intersect(intersect) == intersect); assert(chunking.IntersectPrefixes(intersect) == intersect);
// - The intersection is topological. // - The intersection is topological.
TestBitSet intersect_anc; TestBitSet intersect_anc;
for (auto idx : intersect.transactions) { for (auto idx : intersect.transactions) {