delete pid file
MODIFY
WalletWasabi/BitcoinCore/Configuration/PidFile.cs
WalletWasabi/BitcoinCore/Configuration/PidFile.cs
@@ -40,5 +40,13 @@ namespace WalletWasabi.BitcoinCore.Configuration
IoHelpers.EnsureContainingDirectoryExists(FilePath);
await File.WriteAllTextAsync(FilePath, pid.ToString()).ConfigureAwait(false);
}
+
+ public void Delete()
+ {
+ if (File.Exists(FilePath)
+ {
+ File.Delete(FilePath);
+ }
+ }
}
}

MODIFY
WalletWasabi/BitcoinCore/CoreNode.cs
WalletWasabi/BitcoinCore/CoreNode.cs
@@ -191,6 +191,7 @@ namespace WalletWasabi.BitcoinCore
public async Task<bool> TryStopAsync()
{
+ var pidFile = new PidFile(DataDir, Network);
try
{
var reasonableCoreShutdownTimeout = TimeSpan.FromSeconds(21);
@@ -198,7 +199,6 @@ namespace WalletWasabi.BitcoinCore
var foundConfigDic = Config.ToDictionary();
using CancellationTokenSource cts = new CancellationTokenSource(reasonableCoreShutdownTimeout);
- var pidFile = new PidFile(DataDir, Network);
var pid = await pidFile.TryReadAsync().ConfigureAwait(false);
if (pid.HasValue)
@@ -226,6 +226,10 @@ namespace WalletWasabi.BitcoinCore
{
Logger.LogWarning(ex);
}
+ finally
+ {
+ pidFile.Delete();
+ }
return false;
}

delete pid file