-
Notifications
You must be signed in to change notification settings - Fork 424
Consistently use wire::Message for encoding
#4244
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
Consistently use wire::Message for encoding
#4244
Conversation
|
👋 Thanks for assigning @TheBlueMatt as a reviewer! |
bea6480 to
3c0a1d7
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4244 +/- ##
========================================
Coverage 89.33% 89.33%
========================================
Files 180 180
Lines 138680 139146 +466
Branches 138680 139146 +466
========================================
+ Hits 123888 124311 +423
- Misses 12172 12207 +35
- Partials 2620 2628 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
🔔 1st Reminder Hey @TheBlueMatt! This PR has been waiting for your review. |
TheBlueMatt
left a comment
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 seems weird to replace a correct but unused implementation with an incorrect/panicing one? Can we remove the bound instead?
|
👋 The first review has been submitted! Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer. |
734b4e2 to
c7a57c8
Compare
wire::Message's Writeable implementation with unreachable!wire::Message for encoding
Hmm, turns out I had overlooked a single case where it was used (only when writing out messages on shutdown via a) always consistently use |
|
🔔 1st Reminder Hey @TheBlueMatt! This PR has been waiting for your review. |
| &MessageSendEvent::UpdateHTLCs { .. } => false, | ||
| &MessageSendEvent::SendRevokeAndACK { .. } => false, | ||
| &MessageSendEvent::SendClosingSigned { .. } => false, | ||
| #[cfg(simple_close)] |
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.
we've historically not cfg-flagged messages even if the implementation in LDK isn't complete. There doesn't really seem any reason to imo.
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.
we've historically not cfg-flagged messages even if the implementation in LDK isn't complete. There doesn't really seem any reason to imo.
Hmm, yeah, debatable. But this PR seems the wrong place to drop the cfg(simple_close). I only added the instances that became necessary by the new approach.
c7a57c8 to
3b186c2
Compare
TheBlueMatt
left a comment
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.
Feel free to squash
Previously, `enqueue_message` took an `M: Type + Writeable` reference, which didn't make use of our `wire::Message` type, which turned out to be rather confusing. Here, we use `Message` consistently in `PeerManager`'s `enqueue_message`, but also in `encrypt_message`, etc. While at it we also switch to move semantics, which is a nice cleanup.
Now that we consistently use `wire::Message` everywhere, it's easier to simply use `Message::write`/`Type::write` instead of heaving yet another `wire::write` around. Here we drop `wire::write`, replace the `encode_msg` macro with a method that takes `wire::Message`, and convert a bunch of additional places to move semantics.
3b186c2 to
dfa12d8
Compare
Squashed without further changes. |
TheBlueMatt
left a comment
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.
thanks
Uh oh!
There was an error while loading. Please reload this page.