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

Fix override-features implementation #1549

Merged
merged 2 commits into from
Oct 8, 2020
Merged

Fix override-features implementation #1549

merged 2 commits into from
Oct 8, 2020

Conversation

pm47
Copy link
Member

@pm47 pm47 commented Oct 7, 2020

This is an alternative to #1498.

We were calling nodeParams.features from inside the channel, which is
problematic because we may have overriden those features for specific
peers. This is now fixed.

IncomingPacket.decrypt needs features to tell whether we are using
variable onion or not. What features should we use? Do we have an
unwritten rule that node-level features shouldn't be overriden? This
happens in the relayer and in the post-restart-htlc-cleaner.

We were calling `nodeParams.features` from inside the channel, which is
problematic because we may have overriden those features for specific
peers. This is now fixed.

`IncomingPacket.decrypt` needs features to tell whether we are using
variable onion or not. What features should we use? Do we have an
unwritten rule that node-level features shouldn't be overriden? This
happens in the relayer and in the post-restart-htlc-cleaner.
@pm47 pm47 requested a review from t-bast October 7, 2020 12:48
@pm47
Copy link
Member Author

pm47 commented Oct 7, 2020

Note that if we change the var_onion_optin after a restart, then the post-restart-htlc-cleaner task may not work. We could make PostRestartHtlcCleaner.checkBrokenHtlcs use channels.commitments.localParams.features to decrypt htlcs, wdyt?

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@56d216b). Click here to learn what that means.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##             master    #1549   +/-   ##
=========================================
  Coverage          ?   87.21%           
=========================================
  Files             ?      139           
  Lines             ?    10902           
  Branches          ?      428           
=========================================
  Hits              ?     9508           
  Misses            ?     1394           
  Partials          ?        0           
Impacted Files Coverage Δ
...re/src/main/scala/fr/acinq/eclair/NodeParams.scala 89.65% <100.00%> (ø)
...c/main/scala/fr/acinq/eclair/channel/Channel.scala 85.95% <100.00%> (ø)
...c/main/scala/fr/acinq/eclair/channel/Helpers.scala 96.21% <100.00%> (ø)
...-core/src/main/scala/fr/acinq/eclair/io/Peer.scala 88.77% <100.00%> (ø)
...rc/main/scala/fr/acinq/eclair/io/Switchboard.scala 80.64% <100.00%> (ø)

Copy link
Member

@t-bast t-bast left a comment

Choose a reason for hiding this comment

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

Do we have an unwritten rule that node-level features shouldn't be overriden?

I think so, yes. It feels to me that turning var_onion_optin off is asking for trouble...
There are some features that we may want to make mandatory at some point, and disallow users turning them off, don't you think? It will also allow us to simplify the code by removing some unnecessary if statements. I'm thinking that var_onion_optin is exactly a good candidate for that, there's too much risk of footgun for users if we let them turn it off (it's been battle-tested with 1.5 years in the wild and 0 drawbacks)

@t-bast t-bast merged commit 20e0b4b into master Oct 8, 2020
@t-bast t-bast deleted the fix-override-features branch December 15, 2021 09:46
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