clusterlin: randomize various decisions in SFL (feature)

This introduces a local RNG inside the SFL state, which is used to randomize
various decisions inside the algorithm, in order to make it hard to create
pathological clusters which predictably have bad performance.

The decisions being randomized are:
* When deciding what chunk to attempt to split, the queue order is
  randomized.
* When deciding which dependency to split on, a uniformly random one is
  chosen among those with higher top feerate than bottom feerate within
  the chosen chunk.
* When deciding which chunks to merge, a uniformly random one among those
  with the higher feerate difference is picked.
* When merging two chunks, a uniformly random dependency between them is
  now activated.
* When making the state topological, the queue of chunks to process is
  randomized.
This commit is contained in:
Pieter Wuille
2025-12-10 15:06:21 -05:00
parent ddbfa4dfac
commit 13aad26b78
3 changed files with 91 additions and 43 deletions

View File

@@ -1021,7 +1021,7 @@ FUZZ_TARGET(clusterlin_sfl)
// Initialize SFL state.
if (make_connected) MakeConnected(depgraph);
SpanningForestState sfl(depgraph);
SpanningForestState sfl(depgraph, rng.rand64());
// Function to test the state.
std::vector<FeeFrac> last_diagram;