Skip to content

Conversation

@t-bast
Copy link
Member

@t-bast t-bast commented Dec 13, 2021

This can be useful to match a preimage to a given claim-htlc-success transaction without going through the process of re-creating the transaction from scratch.

We already include the payment hash in htlc-success transactions for that reason.

Fortunately our codecs system is now very flexible: this was prefixed with a type, so we can easily decode old data and encode with the new codec. Code that depends on this will need to explicitly handle the case where paymentHash == ByteVector32.Zeroes.

This shouldn't be a an issue in practice though: these transactions are re-generated when calling handleRemoteSpentCurrent which happens when nodes restart as we replay WatchFundingSpent, so we should always have the payment hash available.

@t-bast t-bast requested a review from pm47 December 13, 2021 16:23
@codecov-commenter
Copy link

codecov-commenter commented Dec 14, 2021

Codecov Report

Merging #2101 (4dbbca7) into master (8ff7dc7) will increase coverage by 0.04%.
The diff coverage is 92.85%.

@@            Coverage Diff             @@
##           master    #2101      +/-   ##
==========================================
+ Coverage   87.57%   87.61%   +0.04%     
==========================================
  Files         165      165              
  Lines       12757    12761       +4     
  Branches      543      538       -5     
==========================================
+ Hits        11172    11181       +9     
+ Misses       1585     1580       -5     
Impacted Files Coverage Δ
...la/fr/acinq/eclair/transactions/Transactions.scala 96.54% <75.00%> (-0.26%) ⬇️
...ire/internal/channel/version0/ChannelCodecs0.scala 96.77% <100.00%> (ø)
...wire/internal/channel/version0/ChannelTypes0.scala 100.00% <100.00%> (ø)
...ire/internal/channel/version1/ChannelCodecs1.scala 98.94% <100.00%> (ø)
...ire/internal/channel/version2/ChannelCodecs2.scala 100.00% <100.00%> (ø)
...ire/internal/channel/version3/ChannelCodecs3.scala 100.00% <100.00%> (ø)
...ala/fr/acinq/eclair/balance/ChannelsListener.scala 93.10% <0.00%> (-3.45%) ⬇️
...main/scala/fr/acinq/eclair/io/PeerConnection.scala 85.54% <0.00%> (+0.40%) ⬆️
...clair/channel/publish/ReplaceableTxPublisher.scala 86.81% <0.00%> (+1.09%) ⬆️
...main/scala/fr/acinq/eclair/router/Validation.scala 92.30% <0.00%> (+1.53%) ⬆️

This can be useful to match a preimage to a given claim-htlc-success
transaction without going through the process of re-creating the transaction
from scratch.

We already include the payment hash in htlc-success transactions for that
reason.
This ensures we handle the case where the payment hash is missing, and the
compiler will help us enforce it.
@t-bast t-bast force-pushed the claim-htlc-success-payment-hash branch from 83029b0 to 4dbbca7 Compare December 15, 2021 14:49
@t-bast t-bast merged commit 8afb02a into master Dec 16, 2021
@t-bast t-bast deleted the claim-htlc-success-payment-hash branch December 16, 2021 09:24
t-bast added a commit that referenced this pull request Apr 24, 2025
We have this legacy class in the `ClaimHtlcTx` hierarchy for legacy
cases that didn't store the `paymentHash` with the transaction. This
was introduced to ensure that nodes who upgraded while a force-close
was happening would still be able to finish force-closing the channel
and get their funds back.

This was introduced in #2101 which was released in eclair v0.7.0 on
01/02/2022. Since we've made several important bug fixes since then,
it should be safe to assume that we don't care about node operators
who update from this very old version while a channel is closing, the
remote commit got confirmed, and some HTLCs must be claimed with the
preimage on-chain.
t-bast added a commit that referenced this pull request Apr 25, 2025
We have this legacy class in the `ClaimHtlcTx` hierarchy for legacy
cases that didn't store the `paymentHash` with the transaction. This
was introduced to ensure that nodes who upgraded while a force-close
was happening would still be able to finish force-closing the channel
and get their funds back.

This was introduced in #2101 which was released in eclair v0.7.0 on
01/02/2022. Since we've made several important bug fixes since then,
it should be safe to assume that we don't care about node operators
who update from this very old version while a channel is closing, the
remote commit got confirmed, and some HTLCs must be claimed with the
preimage on-chain.
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.

4 participants