Skip to content

Conversation

elnosh
Copy link
Contributor

@elnosh elnosh commented Oct 3, 2025

Resolves #4048

Previously `should_broadcast_holder_commitment_txn` would FC a
channel if an outbound HTLC that hasn't been resolved was
`LATENCY_GRACE_PERIOD_BLOCKS` past expiry. For outgoing payments
that won't have an inbound HTLC, block time to allow before we
FC could be higher since we are not in a race to claim an
inbound HTLC. Here we use 2016 blocks which is roughly 2 weeks.
For cases in which a node has been offline for a while, this could
help to fail the HTLC on reconnection instead of causing a FC.

This would give often-offline nodes roughly 2 weeks to come back online to try salvage channel
and not FC in case they had a pending payment that ultimately failed.

I'm not entirely sure if this is the right solution. This causes some tests that expect force-closures after LATENCY_GRACE_PERIOD_BLOCKS for outgoing payments to fail. Opening in draft just to see if I can get review on if this is ok to delay FC for outgoing payments where we don't have an inbound HTLC to claim.

Previously `should_broadcast_holder_commitment_txn` would FC a
channel if an outbound HTLC that hasn't been resolved was
`LATENCY_GRACE_PERIOD_BLOCKS` past expiry. For outgoing payments
that won't have an inbound HTLC, block time to allow before we
FC could be higher since we are not in a race to claim an
inbound HTLC. Here we use 2016 blocks which is roughly 2 weeks.
For cases in which a node has been offline for a while, this could
help to fail the HTLC on reconnection instead of causing a FC.
@ldk-reviews-bot
Copy link

👋 Hi! I see this is a draft PR.
I'll wait to assign reviewers until you mark it as ready for review.
Just convert it out of draft status when you're ready for review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't FC during startup chain relay if we might be able to salvage the channel by connecting to a peer
2 participants