clusterlin: randomize equal-feerate parts of linearization (privacy)

This places equal-feerate chunks (with no dependencies between them) in random
order in the linearization output, hiding information about DepGraph insertion
order from the output. Likewise, it randomizes the order of transactions within
chunks for the same reason.
This commit is contained in:
Pieter Wuille
2025-10-14 15:34:42 -04:00
parent 13aad26b78
commit 5ce2800745
2 changed files with 27 additions and 14 deletions

View File

@@ -2091,8 +2091,9 @@ std::pair<uint64_t, bool> GenericClusterImpl::Relinearize(TxGraphImpl& graph, in
// Invoke the actual linearization algorithm (passing in the existing one).
uint64_t rng_seed = graph.m_rng.rand64();
auto [linearization, optimal, cost] = Linearize(m_depgraph, max_iters, rng_seed, m_linearization);
// Postlinearize to guarantee that the chunks of the resulting linearization are all connected.
// (SFL currently does not guarantee connected chunks even when optimal).
// Postlinearize to undo some of the non-determinism caused by randomizing the linearization.
// This also guarantees that all chunks are connected (which is not guaranteed by SFL
// currently, even when optimal).
PostLinearize(m_depgraph, linearization);
// Update the linearization.
m_linearization = std::move(linearization);