First create order then invoice

This should prevent that we poll for invoices that had an error during order creation.

I should probably fix this with the context package.
This commit is contained in:
ekzyis 2023-11-26 18:34:24 +01:00
parent 0daddb8e5d
commit bc10fe025b
1 changed files with 3 additions and 3 deletions

View File

@ -142,15 +142,15 @@ func HandleOrder(sc context.ServerContext) echo.HandlerFunc {
return err
}
// Start goroutine to poll status and update invoice in background
go sc.Lnd.CheckInvoice(sc.Db, hash)
// Create (unconfirmed) order
o.InvoiceId = invoice.Id
if err := sc.Db.CreateOrder(&o); err != nil {
return err
}
// Start goroutine to poll status and update invoice in background
go sc.Lnd.CheckInvoice(sc.Db, hash)
// TODO: find matching orders
data = map[string]any{