Skip to content

Commit

Permalink
Merge pull request #79 from getAlby/bugfix/do-not-use-sql-function
Browse files Browse the repository at this point in the history
Calculate timestamp in Go to not use PostgreSQL specific function
  • Loading branch information
kiwiidb authored Jan 31, 2022
2 parents d2d2451 + 3f01c33 commit 60a13d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/service/invoicesubscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (svc *LndhubService) ProcessInvoiceUpdate(ctx context.Context, rawInvoice *
svc.Logger.Infof("Invoice update: r_hash:%s state:%v", rHashStr, rawInvoice.State.String())

// Search for an incoming invoice with the r_hash that is NOT settled in our DB
err := svc.DB.NewSelect().Model(&invoice).Where("type = ? AND r_hash = ? AND state <> ? AND expires_at > NOW()", "incoming", rHashStr, "settled").Limit(1).Scan(ctx)
err := svc.DB.NewSelect().Model(&invoice).Where("type = ? AND r_hash = ? AND state <> ? AND expires_at > ?", "incoming", rHashStr, "settled", time.Now()).Limit(1).Scan(ctx)
if err != nil {
svc.Logger.Infof("Invoice not found. Ignoring. r_hash:%s", rHashStr)
return nil
Expand Down

0 comments on commit 60a13d9

Please sign in to comment.