-
Notifications
You must be signed in to change notification settings - Fork 268
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
Use channel_reestablish tlv when sending channel_ready #3025
base: master
Are you sure you want to change the base?
Conversation
When the remote node supports the 'your_last_funding_locked' tlv we do not need to always resend channel_ready when there are no channel updates. The tlv removes the ambiguity about whether our last channel_ready was received.
I refactored the reestablish logic a bit so that sending I added two tests for the legacy (pre-splice) behavior and updated any other tests that expected the old behavior. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, only nits
eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm/Channel.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm/Channel.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/channel/states/ChannelStateTestsHelperMethods.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/channel/states/ChannelStateTestsHelperMethods.scala
Outdated
Show resolved
Hide resolved
...-core/src/test/scala/fr/acinq/eclair/channel/states/c/WaitForDualFundingReadyStateSpec.scala
Outdated
Show resolved
Hide resolved
...-core/src/test/scala/fr/acinq/eclair/channel/states/c/WaitForDualFundingReadyStateSpec.scala
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/channel/states/e/OfflineStateSpec.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/channel/states/e/OfflineStateSpec.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/channel/states/e/OfflineStateSpec.scala
Outdated
Show resolved
Hide resolved
For consistency, "re-sending" log messages should use the spec name, not the internal type.
Thanks for the feedback! I think it should all good now. |
val aliceInit = Init(alice.stateData match { | ||
case d: ChannelDataWithoutCommitments => d.channelParams.localParams.initFeatures | ||
case d: ChannelDataWithCommitments => d.commitments.params.localParams.initFeatures | ||
case _ => Alice.nodeParams.initFeaturesFor(Bob.nodeParams.nodeId) | ||
}) | ||
val bobInit = Init(bob.stateData match { | ||
case d: ChannelDataWithoutCommitments => d.channelParams.localParams.initFeatures | ||
case d: ChannelDataWithCommitments => d.commitments.params.localParams.initFeatures | ||
case _ => Bob.nodeParams.initFeaturesFor(Alice.nodeParams.nodeId) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this pattern matching? Can't you simply do:
val aliceInit = Init(alice.stateData match { | |
case d: ChannelDataWithoutCommitments => d.channelParams.localParams.initFeatures | |
case d: ChannelDataWithCommitments => d.commitments.params.localParams.initFeatures | |
case _ => Alice.nodeParams.initFeaturesFor(Bob.nodeParams.nodeId) | |
}) | |
val bobInit = Init(bob.stateData match { | |
case d: ChannelDataWithoutCommitments => d.channelParams.localParams.initFeatures | |
case d: ChannelDataWithCommitments => d.commitments.params.localParams.initFeatures | |
case _ => Bob.nodeParams.initFeaturesFor(Alice.nodeParams.nodeId) | |
}) | |
val aliceInit = Init(alice.nodeParams.initFeaturesFor(bob.nodeParams.nodeId)) | |
val bobInit = Init(bob.nodeParams.initFeaturesFor(alice.nodeParams.nodeId)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It turns out that NodeParams
used by init
to create alice
and bob
was not using the computed init features. This should be fixed in 317d875.
The `nodeParams` used when creating `alice` and `bob` during `init` did not use the init features set by `computeFeatures`.
When the remote node supports the
your_last_funding_locked
tlv we do not need to always resendchannel_ready
when there are no channel updates. The tlv removes the ambiguity about whether our lastchannel_ready
was received.