mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2026-02-18 04:54:35 +01:00
invoices: pre-check key send expiry
This commit is contained in:
@@ -736,6 +736,12 @@ func (i *InvoiceRegistry) processKeySend(ctx invoiceUpdateCtx,
|
||||
// Use the minimum block delta that we require for settling htlcs.
|
||||
finalCltvDelta := i.cfg.FinalCltvRejectDelta
|
||||
|
||||
// Pre-check expiry here to prevent inserting an invoice that will not
|
||||
// be settled.
|
||||
if ctx.expiry < uint32(ctx.currentHeight+finalCltvDelta) {
|
||||
return errors.New("final expiry too soon")
|
||||
}
|
||||
|
||||
// Create placeholder invoice.
|
||||
invoice := &channeldb.Invoice{
|
||||
CreationDate: i.cfg.Clock.Now(),
|
||||
|
||||
Reference in New Issue
Block a user