Skip to content

Fix warning messages#6840

Merged
guggero merged 2 commits into
lightningnetwork:masterfrom
positiveblue:fix-warning-messages
Oct 26, 2022
Merged

Fix warning messages#6840
guggero merged 2 commits into
lightningnetwork:masterfrom
positiveblue:fix-warning-messages

Conversation

@positiveblue
Copy link
Copy Markdown
Contributor

Stop casting warnings to errors before passing it to the service handling the message. BOLT1 talks about error and warning messages so I created a new interface called ErrorLike.

Warning messages for pending channels are now handled by the funding manager. Until now they were simply ignored.

Currently, the only action triggered by a warning messages sent by our peers is logging.

Fixes #6801

@Roasbeef Roasbeef added this to the v0.16.0 milestone Aug 17, 2022
@positiveblue positiveblue force-pushed the fix-warning-messages branch 2 times, most recently from 5570b13 to a7fb4bd Compare August 19, 2022 15:55
Comment thread lnwire/error.go Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't really see the benefit of this - I dislike changing the peer/brontide code more than it has to be changed. I think it is better if Warning does not embed Error and either:

  • handleError is duplicated with a handleWarning function
  • handleError handles both a Warning or an Error without an interface, and is renamed to handleErrorOrWarning or something similar

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I chose option A 👍

@saubyk saubyk removed this from the v0.16.0 milestone Aug 24, 2022
@saubyk
Copy link
Copy Markdown
Collaborator

saubyk commented Aug 24, 2022

Cleared the milestone for the pr as the issue (#6801) is tagged now

@positiveblue positiveblue force-pushed the fix-warning-messages branch 2 times, most recently from 6e90ecf to 09f0103 Compare August 24, 2022 20:35
@positiveblue positiveblue requested a review from Crypt-iQ August 24, 2022 22:59
Copy link
Copy Markdown
Collaborator

@Crypt-iQ Crypt-iQ left a comment

Choose a reason for hiding this comment

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

i think the link test should be added back and that a fundingmanager test should be added

Comment thread peer/brontide.go Outdated
Comment thread peer/brontide.go Outdated
Comment thread funding/manager.go Outdated
Comment thread lnwire/lnwire.go Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this called anywhere?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can actually also just fall through to the case below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, and the method will be removed soon* (YY comment). However, I added in case someone is using lnwire.WriteElement outside the lnd code base for completeness.

Copy link
Copy Markdown
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

IIRC, you had a test that you used to repro the behavior in the first place? If we modified SendCustomMessage to allow sending messages below the custom message range w/ a build tag (for itests) then we can test this out in the wild to ensure that sending a warning doesn't lead to a force close. This should help catch any future regressions in the future.

Comment thread lnwire/lnwire.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can actually also just fall through to the case below.

Comment thread lnwire/lnwire.go Outdated
Comment thread peer/brontide.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we keep the existing Error method, then we can pass it around as a normal error. Not sure if we 100% want that behavior though...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would leave it like this so we do not have any error in the future using the Error interface for warnings.

@positiveblue positiveblue force-pushed the fix-warning-messages branch 3 times, most recently from 359d6b8 to 7a1b788 Compare October 13, 2022 12:01
@lightninglabs-deploy
Copy link
Copy Markdown
Collaborator

@Roasbeef: review reminder
@Crypt-iQ: review reminder

Copy link
Copy Markdown
Collaborator

@Crypt-iQ Crypt-iQ left a comment

Choose a reason for hiding this comment

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

needs rebase

Copy link
Copy Markdown
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM ❄️

@guggero
Copy link
Copy Markdown
Collaborator

guggero commented Oct 26, 2022

@positiveblue the new linter rules seem to cause a few new complaints.

@positiveblue positiveblue force-pushed the fix-warning-messages branch 2 times, most recently from 06d769f to a48b0a0 Compare October 26, 2022 14:39
Split the logic for processing `error` and `warning` messages from our
peers.
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.

lnd force-closes in response to warning messages

6 participants