Fix IndexFile paths
MODIFY
WalletWasabi/Stores/BitcoinStore.cs
WalletWasabi/Stores/BitcoinStore.cs
@@ -28,7 +28,7 @@ namespace WalletWasabi.Stores
Network = Guard.NotNull(nameof(network), network);
IndexStore = new IndexStore();
- var indexStoreFolderPath = Path.Combine(WorkFolderPath, Network.ToString());
+ var indexStoreFolderPath = Path.Combine(WorkFolderPath, Network.ToString(), "IndexStore");
HashChain = new HashChain();
await IndexStore.InitializeAsync(indexStoreFolderPath, Network, HashChain);
}

MODIFY
WalletWasabi/Stores/HashChain.cs
WalletWasabi/Stores/HashChain.cs
@@ -23,6 +23,8 @@ namespace WalletWasabi.Stores
private SortedDictionary<int, uint256> Chain { get; }
private object Lock { get; }
+ public event PropertyChangedEventHandler PropertyChanged;
+
public int TipHeight
{
get => _tipHeight;
@@ -94,8 +96,6 @@ namespace WalletWasabi.Stores
Lock = new object();
}
- public event PropertyChangedEventHandler PropertyChanged;
-
public void AddOrReplace(int height, uint256 hash)
{
lock (Lock)

MODIFY
WalletWasabi/Stores/IndexStore.cs
WalletWasabi/Stores/IndexStore.cs
@@ -148,18 +148,37 @@ namespace WalletWasabi.Stores
try
{
// Before Wasabi 1.1.5
- var oldIndexFilepath = Path.Combine(EnvironmentHelpers.GetDataDir(Path.Combine("WalletWasabi", "Client")), $"Index{Network}.dat");
+ var oldIndexFilePath = Path.Combine(EnvironmentHelpers.GetDataDir(Path.Combine("WalletWasabi", "Client")), $"Index{Network}.dat");
- if (File.Exists(oldIndexFilepath))
+ // Before Wasabi 1.1.6
+ var oldFileNames = new[] {
+ "ImmatureIndex.dat" ,
+ "ImmatureIndex.dat.dig",
+ "MatureIndex.dat",
+ "MatureIndex.dat.dig"
+ };
+ var oldIndexFolderPath = Path.Combine(EnvironmentHelpers.GetDataDir(Path.Combine("WalletWasabi", "Client")), "BitcoinStore", Network.ToString());
+
+ foreach (var fileName in oldFileNames)
+ {
+ var oldFilePath = Path.Combine(oldIndexFolderPath, fileName);
+ if (File.Exists(oldFilePath))
+ {
+ File.Copy(oldFilePath, oldFilePath.Replace(oldIndexFolderPath, WorkFolderPath), true);
+ File.Delete(oldFilePath);
+ }
+ }
+
+ if (File.Exists(oldIndexFilePath))
{
- string[] allLines = await File.ReadAllLinesAsync(oldIndexFilepath);
+ string[] allLines = await File.ReadAllLinesAsync(oldIndexFilePath);
var matureLines = allLines.SkipLast(100);
var immatureLines = allLines.TakeLast(100);
await MatureIndexFileManager.WriteAllLinesAsync(matureLines);
await ImmatureIndexFileManager.WriteAllLinesAsync(immatureLines);
- File.Delete(oldIndexFilepath);
+ File.Delete(oldIndexFilePath);
}
}
catch (Exception ex)

Fix IndexFile paths