Catch ArgumentException & EndOfStreamException if AddressManager gets corrupted
MODIFY
WalletWasabi/BitcoinP2p/P2pNetwork.cs
WalletWasabi/BitcoinP2p/P2pNetwork.cs
@@ -68,19 +68,13 @@ namespace WalletWasabi.BitcoinP2p
Logger.LogTrace(ex);
AddressManager = new AddressManager();
}
- catch (OverflowException ex)
+ catch (Exception ex) when (ex is OverflowException || ex is FormatException || ex is ArgumentException || ex is EndOfStreamException)
{
// https://github.com/zkSNACKs/WalletWasabi/issues/712
- Logger.LogInfo($"{nameof(AddressManager)} has thrown `{nameof(OverflowException)}`. Attempting to autocorrect.");
- File.Delete(AddressManagerFilePath);
- Logger.LogTrace(ex);
- AddressManager = new AddressManager();
- Logger.LogInfo($"{nameof(AddressManager)} autocorrection is successful.");
- }
- catch (FormatException ex)
- {
// https://github.com/zkSNACKs/WalletWasabi/issues/880
- Logger.LogInfo($"{nameof(AddressManager)} has thrown `{nameof(FormatException)}`. Attempting to autocorrect.");
+ // https://www.reddit.com/r/WasabiWallet/comments/qt0mgz/crashing_on_open/
+ // https://github.com/zkSNACKs/WalletWasabi/issues/5255
+ Logger.LogInfo($"{nameof(AddressManager)} has thrown `{ex.GetType().Name}`. Attempting to autocorrect.");
File.Delete(AddressManagerFilePath);
Logger.LogTrace(ex);
AddressManager = new AddressManager();

Catch ArgumentException & EndOfStreamException if AddressManager gets corrupted