Only wait when disk blocks are close to tip
MODIFY
WalletWasabi/Services/WalletService.cs
WalletWasabi/Services/WalletService.cs
@@ -651,7 +651,7 @@ namespace WalletWasabi.Services
}
catch (SocketException)
{
- Logger.LogInfo<WalletService>("Didn't find local listening and running Bitcoin Core node instance. Trying to fetch needed block from other source.");
+ Logger.LogDebug<WalletService>("Didn't find local listening and running Bitcoin Core node instance. Trying to fetch needed block from other source.");
}
catch (Exception ex)
{
@@ -712,10 +712,12 @@ namespace WalletWasabi.Services
else
{
// If it have the second best, it's most likely running.
- var secondBest = Synchronizer?.GetFilters()?.TakeLast(2)?.FirstOrDefault();
- if (LastBlocksFromCore.ContainsKey(secondBest.BlockHash)) // Then give some time to Core to download, and try again.
+ var lastTwo = Synchronizer?.GetFilters()?.TakeLast(2).ToArray();
+ if (lastTwo != null && lastTwo.Length == 2 && lastTwo[1].BlockHash == hash)
{
- Logger.LogInfo<WalletService>("Local Bitcoin Core doesn't yet have our block. Waiting a bit before trying to download it from other nodes...");
+ if (LastBlocksFromCore.ContainsKey(lastTwo[0].BlockHash)) // Then give some time to Core to download, and try again.
+ {
+ Logger.LogInfo<WalletService>("Found synchronized local Bitcoin Core blocks folder, but it doesn't yet have our block. Waiting a few seconds for the block on the disk before trying to download it from P2P nodes...");
var sec = 0;
while (sec < 60)
@@ -754,6 +756,7 @@ namespace WalletWasabi.Services
}
}
}
+ }
catch (Exception ex)
{
Logger.LogWarning<WalletService>(ex);

Only wait when disk blocks are close to tip