Invert if statements (io-keymanagement)
MODIFY
WalletWasabi/Io/IoManager.cs
WalletWasabi/Io/IoManager.cs
@@ -35,15 +35,17 @@ namespace WalletWasabi.Io
public bool TryReplaceMeWith(string sourcePath)
{
- if (!File.Exists(sourcePath))
+ if (File.Exists(sourcePath))
{
- return false;
- }
-
File.Move(sourcePath, FilePath);
return true;
}
+ else
+ {
+ return false;
+ }
+ }
public bool Exists()
{

MODIFY
WalletWasabi/Io/SafeMutexIoManager.cs
WalletWasabi/Io/SafeMutexIoManager.cs
@@ -43,15 +43,17 @@ namespace WalletWasabi.Io
public new bool TryReplaceMeWith(string sourcePath)
{
- if (!File.Exists(sourcePath))
+ if (File.Exists(sourcePath))
{
- return false;
- }
-
SafeMoveToOriginal(sourcePath);
return true;
}
+ else
+ {
+ return false;
+ }
+ }
// https://stackoverflow.com/a/7957634/2061103
protected void SafeMoveNewToOriginal()

MODIFY
WalletWasabi/KeyManagement/KeyManager.cs
WalletWasabi/KeyManagement/KeyManager.cs
@@ -427,11 +427,7 @@ namespace WalletWasabi.KeyManagement
}
KeyPath path;
- if (!relevantHdPubKeys.Any())
- {
- path = new KeyPath($"{change}/0");
- }
- else
+ if (relevantHdPubKeys.Any())
{
int largestIndex = relevantHdPubKeys.Max(x => x.Index);
List<int> missingIndexes = Enumerable.Range(0, largestIndex).Except(relevantHdPubKeys.Select(x => x.Index)).ToList();
@@ -445,6 +441,10 @@ namespace WalletWasabi.KeyManagement
path = relevantHdPubKeys.First(x => x.Index == largestIndex).NonHardenedKeyPath.Increment();
}
}
+ else
+ {
+ path = new KeyPath($"{change}/0");
+ }
var fullPath = AccountKeyPath.Derive(path);
var pubKey = ExtPubKey.Derive(path).PubKey;

Invert if statements (io-keymanagement)