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:
parent
0daddb8e5d
commit
bc10fe025b
|
@ -142,15 +142,15 @@ func HandleOrder(sc context.ServerContext) echo.HandlerFunc {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start goroutine to poll status and update invoice in background
|
|
||||||
go sc.Lnd.CheckInvoice(sc.Db, hash)
|
|
||||||
|
|
||||||
// Create (unconfirmed) order
|
// Create (unconfirmed) order
|
||||||
o.InvoiceId = invoice.Id
|
o.InvoiceId = invoice.Id
|
||||||
if err := sc.Db.CreateOrder(&o); err != nil {
|
if err := sc.Db.CreateOrder(&o); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start goroutine to poll status and update invoice in background
|
||||||
|
go sc.Lnd.CheckInvoice(sc.Db, hash)
|
||||||
|
|
||||||
// TODO: find matching orders
|
// TODO: find matching orders
|
||||||
|
|
||||||
data = map[string]any{
|
data = map[string]any{
|
||||||
|
|
Loading…
Reference in New Issue