multi: add height-based invoice expiry
This commit adds height-based invoice expiry for hodl invoices that have active htlcs. This allows us to cancel our intentionally held htlcs before channels are force closed. We only add this for hodl invoices because we expect regular invoices to automatically be resolved. We still keep hodl invoices in the time-based expiry queue, because we want to expire open invoices that reach their timeout before any htlcs are added. Since htlcs are added after the invoice is created, we add new htlcs as they arrive in the invoice registry. In this commit, we allow adding of duplicate entries for an invoice to be added to the expiry queue as each htlc arrives to keep implementation simple. Our cancellation logic can already handle the case where an entry is already canceled, so this is ok.
This commit is contained in:
10 files changed
+328
-32
No files matched your search
@@ -1120,3 +1120,23 @@ litecoin.node=ltcd
|
||||
; will accept over the channel update interval.
|
||||
; gossip.max-channel-update-burst=10
|
||||
; gossip.channel-update-interval=1m
|
||||
|
||||
[invoices]
|
||||
; If a hold invoice has accepted htlcs that reach their expiry height and are
|
||||
; not timed out, the channel holding the htlc is force closed to resolve the
|
||||
; invoice's htlcs. To prevent force closes, lnd automatically cancels these
|
||||
; invoices before they reach their expiry height.
|
||||
;
|
||||
; Hold expiry delta describes the number of blocks before expiry that these
|
||||
; invoices should be canceled. Setting this value to 0 will ensure that hold
|
||||
; invoices can be settled right up until their expiry height, but will result
|
||||
; in the channel they are on being force closed if they are not resolved before
|
||||
; expiry.
|
||||
;
|
||||
; Lnd goes to chain before the expiry for a htlc is reached so that there is
|
||||
; time to resolve it on chain. This value needs to be greater than the
|
||||
; DefaultIncomingBroadcastDelta set by lnd, otherwise the channel will be force
|
||||
; closed anyway. A warning will be logged on startup if this value is not large
|
||||
; enough to prevent force closes.
|
||||
;
|
||||
; invoices.holdexpirydelta=15
|
||||
Reference in new issue
Block a user