Skip to content

Commit

Permalink
fix check for expired invoices
Browse files Browse the repository at this point in the history
  • Loading branch information
lnproxy authored May 28, 2023
1 parent 69355e5 commit 5049a36
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lnproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5049a36

Please sign in to comment.