Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relay partially failed htlcs when closing #1706

Merged
merged 3 commits into from
Feb 24, 2021
Merged

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Feb 24, 2021

If a channel closes when we've received an UpdateFailHtlc, signed it but not yet received our peer's revocation, we need to fail the htlc upstream.

That specific scenario was not correctly handled, resulting in upstream htlcs that were not failed which would force our upstream peer to close the channel.

In that scenario the HTLC is in the remoteCommit but not in the nextRemoteCommit.

If a channel closes when we've received an UpdateFailHtlc, signed it but
not yet received our peer's revocation, we need to fail the htlc upstream.

That specific scenario was not correctly handled, resulting in upstream
htlcs that were not failed which would force our upstream peer to close
the channel.
@t-bast t-bast requested a review from pm47 February 24, 2021 15:46
@codecov-io
Copy link

codecov-io commented Feb 24, 2021

Codecov Report

Merging #1706 (47c80e6) into master (c1bf9bd) will decrease coverage by 0.12%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1706      +/-   ##
==========================================
- Coverage   86.18%   86.05%   -0.13%     
==========================================
  Files         151      151              
  Lines       11527    11527              
  Branches      500      508       +8     
==========================================
- Hits         9934     9920      -14     
- Misses       1593     1607      +14     
Impacted Files Coverage Δ
...c/main/scala/fr/acinq/eclair/channel/Helpers.scala 96.22% <100.00%> (ø)
...clair/blockchain/bitcoind/rpc/BatchingClient.scala 86.36% <0.00%> (-13.64%) ⬇️
...cinq/eclair/blockchain/bitcoind/zmq/ZMQActor.scala 90.00% <0.00%> (-5.00%) ⬇️
...main/scala/fr/acinq/eclair/router/Validation.scala 90.76% <0.00%> (-3.85%) ⬇️
.../acinq/eclair/blockchain/bitcoind/ZmqWatcher.scala 98.58% <0.00%> (-0.71%) ⬇️
...cala/fr/acinq/eclair/crypto/TransportHandler.scala 90.21% <0.00%> (-0.55%) ⬇️
...c/main/scala/fr/acinq/eclair/channel/Channel.scala 86.75% <0.00%> (ø)
...nq/eclair/blockchain/electrum/ElectrumWallet.scala 80.51% <0.00%> (+0.25%) ⬆️
...cala/fr/acinq/eclair/payment/relay/NodeRelay.scala 95.27% <0.00%> (+1.57%) ⬆️

@pm47
Copy link
Member

pm47 commented Feb 24, 2021

If a channel closes when we've received an UpdateFailHtlc, signed it but not yet received our peer's revocation, we need to fail the htlc upstream.

I don't think we can. What if the peer publishes its previous commitment (that isn't revoked) and uses the preimage?

@t-bast
Copy link
Member Author

t-bast commented Feb 24, 2021

What if the peer publishes its previous commitment

He can't, we waited for our local commit to be confirmed ;)

@pm47
Copy link
Member

pm47 commented Feb 24, 2021

What if the peer publishes its previous commitment

He can't, we waited for our local commit to be confirmed ;)

Well then yes. Alright, you got me I didn't go past the PR description

Copy link
Member

@pm47 pm47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I see how complex that corner case is and how simple and elegant the fix and the tests are, I think we can be proud of that codebase!

@t-bast t-bast merged commit bf2a35f into master Feb 24, 2021
@t-bast t-bast deleted the closing-partially-failed-htlc branch February 24, 2021 18:08
tompro pushed a commit to tompro/eclair that referenced this pull request Mar 7, 2021
If a channel closes when we've received an UpdateFailHtlc, signed it but
not yet received our peer's revocation, we need to fail the htlc upstream.

That specific scenario was not correctly handled, resulting in upstream
htlcs that were not failed which would force our upstream peer to close
the channel.
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