diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index 74ef8db49..95181a9e3 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -2,7 +2,7 @@ Exe netcoreapp2.0 - 1.0.1.48 + 1.0.1.49 NU1701,CA1816,CA1308,CA1810,CA2208 diff --git a/BTCPayServer/Payments/Lightning/ChargeListener.cs b/BTCPayServer/Payments/Lightning/ChargeListener.cs index a3e1fe964..c2b7f6e6c 100644 --- a/BTCPayServer/Payments/Lightning/ChargeListener.cs +++ b/BTCPayServer/Payments/Lightning/ChargeListener.cs @@ -60,9 +60,6 @@ namespace BTCPayServer.Payments.Lightning private async Task EnsureListening(string invoiceId, bool poll) { - if (Listening(invoiceId)) - return; - var invoice = await _InvoiceRepository.GetInvoice(null, invoiceId); foreach (var paymentMethod in invoice.GetPaymentMethods(_NetworkProvider) .Where(c => c.GetId().PaymentType == PaymentTypes.LightningLike)) @@ -98,7 +95,10 @@ namespace BTCPayServer.Payments.Lightning continue; } - StartListening(listenedInvoice); + if (!Listening(invoiceId)) + { + StartListening(listenedInvoice); + } } } @@ -232,10 +232,7 @@ namespace BTCPayServer.Payments.Lightning _ListeningLightning.Add(listen); listen.ContinueWith(_ => { - lock (_ListenedInvoiceByLightningUrl) - { - _ListeningLightning.Remove(listen); - } + DoneListening(listenedInvoice); }, TaskScheduler.Default); } _ListenedInvoiceByLightningUrl.Add(listenedInvoice.Uri, listenedInvoice);