Add id parse check
MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/CoinJoinStorage/CoinJoinIdStore.cs
WalletWasabi/WabiSabi/Backend/Rounds/CoinJoinStorage/CoinJoinIdStore.cs
@@ -85,11 +85,36 @@ public class CoinJoinIdStore : InMemoryCoinJoinIdStore
updateFile = true;
}
+ var parsedIds = ParseIds(coinjoins, out var stringIds);
+ if (stringIds.Count() != coinjoins.Count())
+ {
+ updateFile = true;
+ }
+
if (updateFile)
{
- File.WriteAllLines(coinJoinIdStoreFilePath, coinjoins);
+ File.WriteAllLines(coinJoinIdStoreFilePath, stringIds);
}
- return new CoinJoinIdStore(coinjoins.Select(id => uint256.Parse(id)), coinJoinIdStoreFilePath);
+ return new CoinJoinIdStore(parsedIds, coinJoinIdStoreFilePath);
+ }
+
+ private static IEnumerable<uint256> ParseIds(IEnumerable<string> coinjoins, out IEnumerable<string> stringIds)
+ {
+ stringIds = Enumerable.Empty<string>();
+ var ids = Enumerable.Empty<uint256>();
+ foreach (var line in coinjoins)
+ {
+ if (uint256.TryParse(line, out uint256 id))
+ {
+ ids = ids.Append(id);
+ stringIds = stringIds.Append(line);
+ }
+ else
+ {
+ Logger.LogError($"Failed to parse coinjoin id: {line}.");
+ }
+ }
+ return ids;
}
}

Add id parse check