Fix stale invoice api for settle invoice

fixes #5049
This commit is contained in:
Kukks 2023-06-07 17:57:03 +02:00
parent ae432ff237
commit aafb4a7f2a
No known key found for this signature in database
GPG Key ID: 8E5530D9D1C93097

View File

@ -521,8 +521,14 @@ namespace BTCPayServer.Services.Invoices
invoiceData.Status = legacyStatus.ToLowerInvariant();
invoiceData.ExceptionStatus = InvoiceExceptionStatus.Marked.ToString().ToLowerInvariant();
_eventAggregator.Publish(new InvoiceEvent(ToEntity(invoiceData), eventName));
await context.SaveChangesAsync();
try
{
await context.SaveChangesAsync();
}
finally
{
_eventAggregator.Publish(new InvoiceEvent(ToEntity(invoiceData), eventName));
}
}
return true;