Skip to content

Conversation

@t-bast
Copy link
Member

@t-bast t-bast commented May 21, 2025

When an HTLC settles downstream while the upstream channel is closing, this allows us to either publish HTLC-success transactions for which we were missing the preimage (if the downstream HTLC was fulfilled) or stop watching the HTLC output (if the downstream HTLC was failed).

We previously re-computed every closing transaction in that case, which was confusing and useless (and also made the tests very verbose, because we had to ignore all the transactions and watches that were duplicates). We now explicitly handle those two cases and only republish the HTLC-success transactions that become available, if any.

We also change the default feerate used for claim-htlc-txs: we used a high feerate in the channel actor, which meant we would skip small HTLCs that weren't economical to spend at that high feerate. But the feerate is actually set inside the tx-publisher actor based on the HTLC expiry, which may happen many blocks after the beginning of the force-close, in which case the feerate may have changed a lot. We now use the minimum feerate in the channel actor to ensure we don't skip HTLCs and let the tx-publisher actor handle RBF.

@t-bast t-bast force-pushed the refactor-htlc-settlement-during-force-close branch from 75a7e9e to b228d9d Compare May 21, 2025 15:35
@t-bast t-bast marked this pull request as ready for review May 21, 2025 15:36
@t-bast t-bast requested a review from sstone May 21, 2025 15:36
@t-bast t-bast force-pushed the refactor-htlc-settlement-during-force-close branch 2 times, most recently from d672691 to a33fb78 Compare May 23, 2025 11:51
t-bast added 2 commits May 23, 2025 14:27
When an HTLC settles downstream while the upstream channel is closing,
this allows us to either publish HTLC-success transactions for which we
were missing the preimage (if the downstream HTLC was fulfilled) or stop
watching the HTLC output (if the downstream HTLC was failed).

We previously re-computed every closing transaction in that case, which
was confusing and useless. We now explicitly handle those two cases and
only republish the HTLC-success transactions that become available, if
any.

We also change the default feerate used for `claim-htlc-txs`: we used a
high feerate in the channel actor, which meant we would skip small HTLCs
that weren't economical to spend at that high feerate. But the feerate
is actually set inside the tx-publisher actor based on the HTLC expiry,
which may happen many blocks after the beginning of the force-close, in
which case the feerate may have changed a lot. We now use the minimum
feerate in the channel actor to ensure we don't skip HTLCs and let the
tx-publisher actor handle RBF.
This is something we should have added a long time ago to help the
closing tests be more readable. Better late than never!
@t-bast t-bast force-pushed the refactor-htlc-settlement-during-force-close branch from a33fb78 to 1f9fe78 Compare May 23, 2025 12:33
@t-bast t-bast merged commit fb84a9d into master Jun 2, 2025
1 check passed
@t-bast t-bast deleted the refactor-htlc-settlement-during-force-close branch June 2, 2025 08:29
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.

3 participants