Fix coin vs script resolution
MODIFY
WalletWasabi/WabiSabi/Backend/Banning/CoinVerifier.cs
WalletWasabi/WabiSabi/Backend/Banning/CoinVerifier.cs
@@ -80,8 +80,6 @@ public class CoinVerifier
{
var before = DateTimeOffset.UtcNow;
- var coinDictionary = coinsToCheck.DistinctBy(c => c.ScriptPubKey).ToDictionary(c => c.ScriptPubKey);
-
using CancellationTokenSource cancellationTokenSource = new(TimeSpan.FromSeconds(30));
using CancellationTokenSource linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationTokenSource.Token, cancellationToken);
@@ -108,8 +106,10 @@ public class CoinVerifier
await foreach (var response in CoinVerifierApiClient.VerifyScriptsAsync(scriptsToCheck, linkedCts.Token))
{
bool shouldBanUtxo = CheckForFlags(response.ApiResponseItem);
- var coin = coinDictionary[response.ScriptPubKey];
+ // Find all coins with the same script (address reuse).
+ foreach (var coin in coinsToCheck.Where(c => c.ScriptPubKey == response.ScriptPubKey))
+ {
if (!shouldBanUtxo)
{
Whitelist.Add(coin.Outpoint);
@@ -117,6 +117,7 @@ public class CoinVerifier
yield return new CoinVerifyInfo(shouldBanUtxo, coin);
}
+ }
if (Whitelist.ChangeId != lastChangeId)
{

Fix coin vs script resolution