feat: allow configurable force-close buffer for claimable HTLCs#4401
feat: allow configurable force-close buffer for claimable HTLCs#4401okekefrancis112 wants to merge 3 commits intolightningdevkit:mainfrom
Conversation
|
👋 I see @valentinewallace was un-assigned. |
ca4bccc to
59439dc
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4401 +/- ##
==========================================
+ Coverage 86.02% 86.04% +0.02%
==========================================
Files 156 156
Lines 103100 103477 +377
Branches 103100 103477 +377
==========================================
+ Hits 88693 89040 +347
- Misses 11896 11925 +29
- Partials 2511 2512 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
59439dc to
c894222
Compare
TheBlueMatt
left a comment
There was a problem hiding this comment.
There's a bunch of checks in channelmanager.rs that need to be equivalently enforce on settings. In any case, please carefully go through every use of CLTV_CLAIM_BUFFER and maybe all the block-count-constants read the associated comments, and consider if we should update anything or if it might imply changes somewhere.
| htlc: SentHTLCId, | ||
| }, | ||
| /// Used to update the configurable force-close CLTV buffer for claimable HTLCs. | ||
| ChannelConfigUpdated { |
There was a problem hiding this comment.
Bleh, pushing through a monitor update is a heavy persistence operation. Instead, let's just make this configurable on the ChainMonitor and keep the settings memory-only.
There was a problem hiding this comment.
Thank you for pointing this out. Your review is greatly appreciated, I will work on this and push it.
This PR adds a configurable
force_close_claimable_htlc_cltv_buffertoChannelConfig, allowing users to control how far in advance an inbound channel is force-closed when an HTLC becomes claimable. Previously, this buffer was hardcoded toCLTV_CLAIM_BUFFER(36 blocks), limiting users’ ability to tolerate their own downtime. The new field defaults to the existing constant, enforces the same minimum, and is validated againstcltv_expiry_deltato preserve safety guarantees. The value is propagated toChannelMonitor, persisted via monitor updates and serialization, and used in place of the hardcoded constant when deciding whether to broadcast a holder commitment transaction. This change improves configurability without altering default behavior.Closes: #3837