1 KiB
UNDF: UNDF-2026-000000922
wasabi-0003: Arena.RegisterInputCoreAsync O(R*A) linear scan for duplicate detection
Location
WalletWasabi/WabiSabi/Coordinator/Rounds/Arena.Partial.cs:51
Defect
On every input registration request, the coordinator flattens all Alices
across all active rounds into an IEnumerable and calls .Any(x => x.Outpoint == coin.Outpoint).
This is O(R * A) where R = active rounds and A = average Alices per round.
This runs on the coordinator hot path, once per input registration request. During peak CoinJoin activity with multiple parallel rounds and hundreds of registered inputs, this becomes a significant linear scan on every request.
Severity
MEDIUM-HIGH. R=5 rounds * A=100 inputs = 500 comparisons per registration. With 100 registrations per round cycle, that is 50,000 comparisons. With HashSet: 100 + 500 (build once, lookup O(1)).
Fix
Materialize registered outpoints into HashSet for O(1) lookup.
Estimated speedup
At R=5, A=100: ~100x reduction in comparison operations per request.