From ec23eae21dc3ecbd2c97195eff7dd7bca2eada76 Mon Sep 17 00:00:00 2001 From: rockstardev Date: Tue, 18 Dec 2018 11:56:51 -0600 Subject: [PATCH] Ensuding that payments are always ordered by time for consistency --- BTCPayServer/Services/Invoices/InvoiceRepository.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/BTCPayServer/Services/Invoices/InvoiceRepository.cs b/BTCPayServer/Services/Invoices/InvoiceRepository.cs index 5bbaccb6e..47d4210ff 100644 --- a/BTCPayServer/Services/Invoices/InvoiceRepository.cs +++ b/BTCPayServer/Services/Invoices/InvoiceRepository.cs @@ -41,7 +41,7 @@ namespace BTCPayServer.Services.Invoices public InvoiceRepository(ApplicationDbContextFactory contextFactory, string dbreezePath) { int retryCount = 0; - retry: +retry: try { _Engine = new DBreezeEngine(dbreezePath); @@ -385,7 +385,8 @@ namespace BTCPayServer.Services.Invoices var paymentEntity = ToObject(p.Blob, null); paymentEntity.Accounted = p.Accounted; return paymentEntity; - }).ToList(); + }) + .OrderBy(a => a.ReceivedTime).ToList(); #pragma warning restore CS0618 var state = invoice.GetInvoiceState(); entity.ExceptionStatus = state.ExceptionStatus;