mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-02-23 15:14:49 +01:00
Fix: Lightning Listener not listening on Lightning payment after activating when using lazy payments (#2524)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using BTCPayServer.Services.Invoices;
|
||||
using BTCPayServer.Services.Invoices;
|
||||
|
||||
namespace BTCPayServer.Events
|
||||
{
|
||||
|
||||
24
BTCPayServer/Events/InvoicePaymentMethodActivated.cs
Normal file
24
BTCPayServer/Events/InvoicePaymentMethodActivated.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using BTCPayServer.Payments;
|
||||
using BTCPayServer.Services.Invoices;
|
||||
|
||||
namespace BTCPayServer.Events
|
||||
{
|
||||
public class InvoicePaymentMethodActivated : IHasInvoiceId
|
||||
{
|
||||
public PaymentMethodId PaymentMethodId { get; }
|
||||
public InvoiceEntity InvoiceEntity { get; }
|
||||
|
||||
public InvoicePaymentMethodActivated(PaymentMethodId paymentMethodId, InvoiceEntity invoiceEntity)
|
||||
{
|
||||
PaymentMethodId = paymentMethodId;
|
||||
InvoiceEntity = invoiceEntity;
|
||||
}
|
||||
|
||||
public string InvoiceId => InvoiceEntity.Id;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Invoice {InvoiceId} activated payment method {PaymentMethodId}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -168,6 +168,13 @@ namespace BTCPayServer.Payments.Lightning
|
||||
}
|
||||
|
||||
}));
|
||||
leases.Add(_Aggregator.Subscribe<Events.InvoicePaymentMethodActivated>(async inv =>
|
||||
{
|
||||
if (inv.PaymentMethodId.PaymentType == LightningPaymentType.Instance)
|
||||
{
|
||||
_CheckInvoices.Writer.TryWrite(inv.InvoiceId);
|
||||
}
|
||||
}));
|
||||
_CheckingInvoice = CheckingInvoice(_Cts.Token);
|
||||
_ListenPoller = new Timer(async s =>
|
||||
{
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace BTCPayServer.Services.Invoices
|
||||
prepare);
|
||||
eligibleMethodToActivate.SetPaymentMethodDetails(newDetails);
|
||||
await invoiceRepository.UpdateInvoicePaymentMethod(invoice.Id, eligibleMethodToActivate);
|
||||
eventAggregator.Publish(new InvoicePaymentMethodActivated(paymentMethodId, invoice));
|
||||
}
|
||||
catch (PaymentMethodUnavailableException ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user