From 3d5361cd11574a5c18cc656b9bf5362701e1bdc1 Mon Sep 17 00:00:00 2001 From: Nicolas Dorier Date: Thu, 25 May 2023 19:42:23 +0900 Subject: [PATCH] [Bug] If a altcoins is disabled from BTCPay and payout processor is used, it would crash at restart (#4997) Co-authored-by: Andrew Camilleri --- .../PayoutProcessors/PayoutProcessorService.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/BTCPayServer/PayoutProcessors/PayoutProcessorService.cs b/BTCPayServer/PayoutProcessors/PayoutProcessorService.cs index ccd4a9266..b27294e5b 100644 --- a/BTCPayServer/PayoutProcessors/PayoutProcessorService.cs +++ b/BTCPayServer/PayoutProcessors/PayoutProcessorService.cs @@ -136,7 +136,16 @@ public class PayoutProcessorService : EventHostedServiceBase if (matchedProcessor is not null) { await StopProcessor(data.Id, cancellationToken); - var processor = await matchedProcessor.ConstructProcessor(data); + IHostedService processor = null; + try + { + processor = await matchedProcessor.ConstructProcessor(data); + } + catch(Exception ex) + { + Logs.PayServer.LogWarning(ex, $"Payout processor ({data.PaymentMethod}) failed to start. Skipping..."); + return; + } await processor.StartAsync(cancellationToken); Services.TryAdd(data.Id, processor); }