Fix invoice polling finds no rows
This commit is contained in:
parent
aa6db6a5e1
commit
fb7fbae699
|
@ -92,14 +92,16 @@ func HandleCreateMarket(sc context.ServerContext) echo.HandlerFunc {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
go sc.Lnd.CheckInvoice(sc.Db, hash)
|
|
||||||
|
|
||||||
m.InvoiceId = invoice.Id
|
m.InvoiceId = invoice.Id
|
||||||
if err := sc.Db.CreateMarket(tx, ctx, &m); err != nil {
|
if err := sc.Db.CreateMarket(tx, ctx, &m); err != nil {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// need to commit before starting to poll invoice status
|
||||||
|
tx.Commit()
|
||||||
|
go sc.Lnd.CheckInvoice(sc.Db, hash)
|
||||||
|
|
||||||
data = map[string]any{
|
data = map[string]any{
|
||||||
"id": invoice.Id,
|
"id": invoice.Id,
|
||||||
"bolt11": invoice.PaymentRequest,
|
"bolt11": invoice.PaymentRequest,
|
||||||
|
@ -179,7 +181,8 @@ func HandleOrder(sc context.ServerContext) echo.HandlerFunc {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start goroutine to poll status and update invoice in background
|
// need to commit before startign to poll invoice status
|
||||||
|
tx.Commit()
|
||||||
go sc.Lnd.CheckInvoice(sc.Db, hash)
|
go sc.Lnd.CheckInvoice(sc.Db, hash)
|
||||||
|
|
||||||
// TODO: find matching orders
|
// TODO: find matching orders
|
||||||
|
|
Loading…
Reference in New Issue