Skip to content

Conversation

TheBlueMatt
Copy link
Collaborator

If a peer sends us a channel_update for our own channel with an htlc_minimum_msat which is more than the channel's amount, that's dumb, but there's no reason to force-close the channel. We don't even use the field.

Here we simply drop the unnecessary check.

I had a channel that hit this. Waiting to hear back from the peer as to why or how they generated such nonsense, but there's no reason for the FC.

If a peer sends us a `channel_update` for our own channel with an
`htlc_minimum_msat` which is more than the channel's amount, that's
dumb, but there's no reason to force-close the channel. We don't
even use the field.

Here we simply drop the unnecessary check.
@TheBlueMatt TheBlueMatt added this to the 0.0.117 milestone Sep 28, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 28, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (7b4fb9d) 88.98% compared to head (d66d38e) 89.01%.
Report is 2 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2611      +/-   ##
==========================================
+ Coverage   88.98%   89.01%   +0.02%     
==========================================
  Files         113      113              
  Lines       86291    86288       -3     
  Branches    86291    86288       -3     
==========================================
+ Hits        76787    76805      +18     
+ Misses       7267     7250      -17     
+ Partials     2237     2233       -4     
Files Coverage Δ
lightning/src/ln/channel.rs 88.33% <ø> (+0.01%) ⬆️
lightning/src/ln/channelmanager.rs 81.61% <100.00%> (+0.01%) ⬆️

... and 9 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -5538,9 +5538,6 @@ impl<SP: Deref> Channel<SP> where
}

pub fn channel_update(&mut self, msg: &msgs::ChannelUpdate) -> Result<(), ChannelError> {
if msg.contents.htlc_minimum_msat >= self.context.channel_value_satoshis * 1000 {
return Err(ChannelError::Close("Minimum htlc value is greater than channel value".to_string()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe should log it still?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Even better, I'll just log the full message.

Copy link
Contributor

Choose a reason for hiding this comment

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

We log the update, but don't log that it was bogus htlc_minimum_msat?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

True, but we also don't do anything with it so its not really an error that's interesting. We should maybe consider not ignoring it, but the spec isn't super clear on if we have to honor it anyway. In any case, the full message with all its fields is probably more interesting than something specific to one field.

Copy link
Contributor

@dunxen dunxen left a comment

Choose a reason for hiding this comment

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

Makes sense. I don't think spec recommends FC anyway.

@TheBlueMatt TheBlueMatt merged commit 4ab6c55 into lightningdevkit:main Sep 28, 2023
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.

6 participants