From 5a8c959b6baf0d8ed66167ecd263a945325da6d3 Mon Sep 17 00:00:00 2001 From: Nicolas Dorier Date: Sat, 11 Jan 2025 00:15:04 +0900 Subject: [PATCH] Server hanging in debug mode if altcoin node is unavailable (#6545) --- BTCPayServer.Client/BTCPayServer.Client.csproj | 2 +- BTCPayServer.Rating/BTCPayServer.Rating.csproj | 2 +- BTCPayServer/Services/Cheater.cs | 14 +++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/BTCPayServer.Client/BTCPayServer.Client.csproj b/BTCPayServer.Client/BTCPayServer.Client.csproj index 30c047653..d90b37706 100644 --- a/BTCPayServer.Client/BTCPayServer.Client.csproj +++ b/BTCPayServer.Client/BTCPayServer.Client.csproj @@ -31,7 +31,7 @@ - + diff --git a/BTCPayServer.Rating/BTCPayServer.Rating.csproj b/BTCPayServer.Rating/BTCPayServer.Rating.csproj index 475d2114f..2ef9c74d9 100644 --- a/BTCPayServer.Rating/BTCPayServer.Rating.csproj +++ b/BTCPayServer.Rating/BTCPayServer.Rating.csproj @@ -6,7 +6,7 @@ - + diff --git a/BTCPayServer/Services/Cheater.cs b/BTCPayServer/Services/Cheater.cs index da0ff262a..4144f58e5 100644 --- a/BTCPayServer/Services/Cheater.cs +++ b/BTCPayServer/Services/Cheater.cs @@ -33,7 +33,11 @@ namespace BTCPayServer.Services if (liquid is not null) { var lbtcrpc = GetCashCow(liquid.CryptoCode); - await lbtcrpc.SendCommandAsync("rescanblockchain"); + try + { + await lbtcrpc.SendCommandAsync("rescanblockchain"); + } + catch { goto next; } var elements = _prov.NetworkProviders.GetAll().OfType(); foreach (Plugins.Altcoins.ElementsBTCPayNetwork element in elements) { @@ -50,8 +54,12 @@ namespace BTCPayServer.Services } } } - - await Task.WhenAll(_prov.GetAll().Select(o => o.Item2.RPCClient.ScanRPCCapabilitiesAsync())); + next: + try + { + await Task.WhenAll(_prov.GetAll().Select(o => o.Item2.RPCClient.ScanRPCCapabilitiesAsync())); + } + catch { } } Task IHostedService.StopAsync(CancellationToken cancellationToken)