starts HWI next to Wasabi exe only on Windows because previously Windows Defender deleted it.
MODIFY
WalletWasabi.Gui/Global.cs
WalletWasabi.Gui/Global.cs
@@ -161,7 +161,7 @@ namespace WalletWasabi.Gui
try
{
- await HwiProcessManager.EnsureHwiInstalledAsync(DataDir, Network);
+ await HwiProcessManager.InitializeAsync(DataDir, Network);
}
catch (Exception ex)
{

MODIFY
WalletWasabi.Packager/Program.cs
WalletWasabi.Packager/Program.cs
@@ -108,13 +108,19 @@ namespace WalletWasabi.Packager
using (var response = httpClient.GetAsync("snapshots/latest/", HttpCompletionOption.ResponseContentRead).GetAwaiter().GetResult())
{
if (response.StatusCode != HttpStatusCode.OK)
+ {
throw new HttpRequestException(response.StatusCode.ToString());
+ }
+
var responseString = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
var json = (JObject)JsonConvert.DeserializeObject(responseString);
foreach (JProperty node in json["nodes"])
{
if (!node.Name.ToString().Contains(".onion"))
+ {
continue;
+ }
+
var userAgent = ((JArray)node.Value)[1].ToString();
if (userAgent.Contains("Satoshi:0.16") || userAgent.Contains("Satoshi:0.17"))
{
@@ -145,10 +151,6 @@ namespace WalletWasabi.Packager
File.Move(Path.Combine(tempDir, "Tor", "tor"), Path.Combine(tempDir, "TorOsx"));
string hwiSoftwareDir = Path.Combine(LibraryProjectDirectory, "Hwi", "Software");
- string hwiWinZip = Path.Combine(hwiSoftwareDir, "hwi-win64.zip");
- IoHelpers.BetterExtractZipToDirectoryAsync(hwiWinZip, tempDir).GetAwaiter();
- File.Move(Path.Combine(tempDir, "hwi.exe"), Path.Combine(tempDir, "HwiWin"));
-
string hwiLinuxZip = Path.Combine(hwiSoftwareDir, "hwi-linux64.zip");
IoHelpers.BetterExtractZipToDirectoryAsync(hwiLinuxZip, tempDir).GetAwaiter();
File.Move(Path.Combine(tempDir, "hwi"), Path.Combine(tempDir, "HwiLin"));
@@ -299,7 +301,7 @@ namespace WalletWasabi.Packager
process.WaitForExit();
}
- IoHelpers.DeleteRecursivelyWithMagicDustAsync(publishedFolder).GetAwaiter().GetResult();
+ IoHelpers.DeleteRecursivelyWithMagicDustAsync(publishedFolder).GetAwaiter();
Console.WriteLine($"Deleted {publishedFolder}");
}
}
@@ -339,7 +341,7 @@ namespace WalletWasabi.Packager
{
if (Directory.Exists(BinDistDirectory))
{
- IoHelpers.DeleteRecursivelyWithMagicDustAsync(BinDistDirectory).GetAwaiter().GetResult();
+ IoHelpers.DeleteRecursivelyWithMagicDustAsync(BinDistDirectory).GetAwaiter();
Console.WriteLine($"Deleted {BinDistDirectory}");
}
@@ -369,12 +371,12 @@ namespace WalletWasabi.Packager
var libraryBinReleaseDirectory = Path.GetFullPath(Path.Combine(LibraryProjectDirectory, "bin\\Release"));
if (Directory.Exists(guiBinReleaseDirectory))
{
- IoHelpers.DeleteRecursivelyWithMagicDustAsync(guiBinReleaseDirectory).GetAwaiter().GetResult();
+ IoHelpers.DeleteRecursivelyWithMagicDustAsync(guiBinReleaseDirectory).GetAwaiter();
Console.WriteLine($"Deleted {guiBinReleaseDirectory}");
}
if (Directory.Exists(libraryBinReleaseDirectory))
{
- IoHelpers.DeleteRecursivelyWithMagicDustAsync(libraryBinReleaseDirectory).GetAwaiter().GetResult();
+ IoHelpers.DeleteRecursivelyWithMagicDustAsync(libraryBinReleaseDirectory).GetAwaiter();
Console.WriteLine($"Deleted {libraryBinReleaseDirectory}");
}
@@ -442,7 +444,9 @@ namespace WalletWasabi.Packager
Tools.ClearSha512Tags(currentBinDistDirectory);
//Tools.RemoveSosDocsUnix(currentBinDistDirectory);
- // Remove Hwi binaries those are not relevant to the platform.
+ // Remove HWI binaries those are not relevant to the platform.
+ // On Windows HWI starts from next to the exe because Windows Defender sometimes deletes it.
+ // On Linux and OSX HWI starts from the data folder because otherwise there'd be permission issues.
var hwiFolder = new DirectoryInfo(Path.Combine(currentBinDistDirectory, "Hwi", "Software"));
// Remove Tor binaries those are not relevant to the platform.
var torFolder = new DirectoryInfo(Path.Combine(currentBinDistDirectory, "TorDaemons"));
@@ -467,6 +471,14 @@ namespace WalletWasabi.Packager
}
}
+ foreach (var dir in hwiFolder.EnumerateDirectories())
+ {
+ if (!dir.Name.Contains(toNotremove, StringComparison.OrdinalIgnoreCase))
+ {
+ IoHelpers.DeleteRecursivelyWithMagicDustAsync(dir.FullName).GetAwaiter();
+ }
+ }
+
// Rename the final exe.
string oldExecutablePath;
string newExecutablePath;
@@ -642,10 +654,10 @@ namespace WalletWasabi.Packager
process.WaitForExit();
}
- IoHelpers.DeleteRecursivelyWithMagicDustAsync(publishedFolder).GetAwaiter().GetResult();
+ IoHelpers.DeleteRecursivelyWithMagicDustAsync(publishedFolder).GetAwaiter();
File.Delete(uncompressedDmgFilePath);
- IoHelpers.DeleteRecursivelyWithMagicDustAsync(publishedFolder).GetAwaiter().GetResult();
+ IoHelpers.DeleteRecursivelyWithMagicDustAsync(publishedFolder).GetAwaiter();
Console.WriteLine($"Deleted {publishedFolder}");
}
else if (target.StartsWith("linux"))
@@ -766,13 +778,13 @@ namespace WalletWasabi.Packager
process.WaitForExit();
}
- IoHelpers.DeleteRecursivelyWithMagicDustAsync(debFolderPath).GetAwaiter().GetResult();
+ IoHelpers.DeleteRecursivelyWithMagicDustAsync(debFolderPath).GetAwaiter();
string oldDeb = Path.Combine(BinDistDirectory, $"{ExecutableName}_{VersionPrefix}_amd64.deb");
string newDeb = Path.Combine(BinDistDirectory, $"Wasabi-{VersionPrefix}.deb");
File.Move(oldDeb, newDeb);
- IoHelpers.DeleteRecursivelyWithMagicDustAsync(publishedFolder).GetAwaiter().GetResult();
+ IoHelpers.DeleteRecursivelyWithMagicDustAsync(publishedFolder).GetAwaiter();
Console.WriteLine($"Deleted {publishedFolder}");
}
}

MODIFY
WalletWasabi/Hwi/HwiProcessManager.cs
WalletWasabi/Hwi/HwiProcessManager.cs
@@ -22,16 +22,11 @@ namespace WalletWasabi.Hwi
public static class HwiProcessManager
{
public const string MutexName = "Global\\FE5C8D9C-E000-495F-8175-A8713E449B2E";
+ private static Random Random { get; } = new Random();
+ public static AsyncLock AsyncLock { get; } = new AsyncLock();
public static string HwiPath { get; private set; }
- public static AsyncLock AsyncLock { get; }
public static Network Network { get; private set; }
- static HwiProcessManager()
- {
- AsyncLock = new AsyncLock();
- Network = Network.Main;
- }
-
public static async Task<PSBT> SignTxAsync(HardwareWalletInfo hardwareWalletInfo, PSBT psbt)
{
var psbtString = psbt.ToBase64();
@@ -87,8 +82,6 @@ namespace WalletWasabi.Hwi
return hwis;
}
- private static Random Random { get; } = new Random();
-
public static async Task<JToken> SendCommandAsync(string command, bool isMutexPriority = false)
{
using (await AsyncLock.LockAsync())
@@ -208,7 +201,7 @@ namespace WalletWasabi.Hwi
}
}
- public static async Task EnsureHwiInstalledAsync(string dataDir, Network network, bool logFound = true)
+ public static async Task InitializeAsync(string dataDir, Network network, bool logFound = true)
{
Network = network;
@@ -221,18 +214,16 @@ namespace WalletWasabi.Hwi
}
}
- var hwiDir = Path.Combine(dataDir, "hwi");
-
- string hwiPath;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
- hwiPath = $@"{hwiDir}\hwi.exe";
- }
- else // Linux or OSX
- {
- hwiPath = $@"{hwiDir}/hwi";
+ HwiPath = Path.Combine(fullBaseDirectory, "Hwi", "Software", "hwi-win64", "hwi.exe");
+ return;
}
+ var hwiDir = Path.Combine(dataDir, "hwi");
+
+ string hwiPath = $@"{hwiDir}/hwi";
+
if (!File.Exists(hwiPath))
{
Logger.LogInfo($"HWI instance NOT found at {hwiPath}. Attempting to acquire it...", nameof(HwiProcessManager));
@@ -266,14 +257,6 @@ namespace WalletWasabi.Hwi
{
string hwiSoftwareDir = Path.Combine(fullBaseDirectory, "Hwi", "Software");
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- string hwiWinZip = Path.Combine(hwiSoftwareDir, "hwi-win64.zip");
- await IoHelpers.BetterExtractZipToDirectoryAsync(hwiWinZip, hwiDir);
- Logger.LogInfo($"Extracted {hwiWinZip} to {hwiDir}.", nameof(HwiProcessManager));
- }
- else // Linux or OSX
- {
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
string hwiLinuxZip = Path.Combine(hwiSoftwareDir, "hwi-linux64.zip");
@@ -294,4 +277,3 @@ namespace WalletWasabi.Hwi
}
}
}
-}

MODIFY
WalletWasabi/Hwi/Software/digests.txt
WalletWasabi/Hwi/Software/digests.txt
4d63ff6930dae6ae74a657110384a3812acb86613b7875e76a9cee13295cbca6
a9912911eed066b17d99ad28330f262ace4577a99cf835e6d7360763b09744dd
\ No newline at end of file
-fadef8cd9654e04a4ed369abb177aacd2322dc9e994b3a77a53c978274849597

RENAME
WalletWasabi/Hwi/Software/hwi-win64.zip
WalletWasabi/Hwi/Software/hwi-win64/hwi.exe
Binary files a/WalletWasabi/Hwi/Software/hwi-win64.zip and b/WalletWasabi/Hwi/Software/hwi-win64/hwi.exe differ

MODIFY
WalletWasabi/WalletWasabi.csproj
WalletWasabi/WalletWasabi.csproj
</ItemGroup>
<ItemGroup>
+ <None Update="Hwi\Software\hwi-win64\hwi.exe">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
<None Update="OnionSeeds\MainOnionSeeds.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>

starts HWI next to Wasabi exe only on Windows because previously Windows Defender deleted it.