From 5049a36caa5d47714ad8290700ef65db8f73d2c7 Mon Sep 17 00:00:00 2001 From: anon <109770337+lnproxy@users.noreply.github.com> Date: Sun, 28 May 2023 09:06:49 -0400 Subject: [PATCH] fix check for expired invoices --- lnproxy.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lnproxy.go b/lnproxy.go index c7cd8f3..31516fe 100644 --- a/lnproxy.go +++ b/lnproxy.go @@ -130,10 +130,10 @@ func Wrap(r RelayParameters, x ProxyParameters, p DecodedInvoice) (*InvoiceParam q.Memo = p.Description } - q.Expiry = p.Timestamp + p.Expiry - uint64(time.Now().Unix()) - r.ExpiryBuffer - if q.Expiry < 0 { + if p.Timestamp + p.Expiry < uint64(time.Now().Unix()) + r.ExpiryBuffer { return nil, 0, errors.Join(ClientFacing, errors.New("payment request expiration is too close.")) } + q.Expiry = p.Timestamp + p.Expiry - uint64(time.Now().Unix()) - r.ExpiryBuffer q.CltvExpiry = p.CltvExpiry*r.CltvDeltaBeta + r.CltvDeltaAlpha if q.CltvExpiry >= r.MaxCltvDelta {