diff --git a/lib/service/invoicesubscription.go b/lib/service/invoicesubscription.go index 0a20a021..ec26c4bb 100644 --- a/lib/service/invoicesubscription.go +++ b/lib/service/invoicesubscription.go @@ -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