mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-02-19 13:14:21 +01:00
Adding invoice back to pending to track confirmations if less than max
This commit is contained in:
@@ -238,6 +238,10 @@ namespace BTCPayServer.Payments.Bitcoin
|
||||
}
|
||||
}
|
||||
|
||||
// if needed add invoice back to pending to track number of confirmations
|
||||
if (paymentData.ConfirmationCount < wallet.Network.MaxTrackedConfirmation)
|
||||
await _InvoiceRepository.AddPendingInvoiceIfNotPresent(invoice.Id);
|
||||
|
||||
if (updated)
|
||||
updatedPaymentEntities.Add(payment);
|
||||
}
|
||||
|
||||
@@ -274,6 +274,18 @@ retry:
|
||||
}
|
||||
}
|
||||
|
||||
public async Task AddPendingInvoiceIfNotPresent(string invoiceId)
|
||||
{
|
||||
using (var context = _ContextFactory.CreateContext())
|
||||
{
|
||||
if (!context.PendingInvoices.Any(a => a.Id == invoiceId))
|
||||
{
|
||||
context.PendingInvoices.Add(new PendingInvoiceData() { Id = invoiceId });
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task AddInvoiceEvent(string invoiceId, object evt)
|
||||
{
|
||||
using (var context = _ContextFactory.CreateContext())
|
||||
|
||||
Reference in New Issue
Block a user