Wait to free the holding cell during channel_reestablish handling#1859
Merged
TheBlueMatt merged 4 commits intolightningdevkit:mainfrom Nov 22, 2022
Merged
Conversation
Asserting that specific log entries were printed isn't all that useful, we should really be focusing on the expected messages (or, when a monitor udpate fails, the lack thereof). In the next commit one of these log checks would otherwise break due to the particular time a monitor update fails changing, but I also plan on reworking the montior update flows substantially soon, breaking lots of them.
When we process a `channel_reestablish` message we free the HTLC update holding cell as things may have changed while we were disconnected. However, some time ago, to handle freeing from the holding cell when a monitor update completes, we added a holding cell freeing check in `get_and_clear_pending_msg_events`. This leaves the in-`channel_reestablish` holding cell clear redundant, as doing it immediately or is `get_and_clear_pending_msg_events` is not a user-visible difference. Thus, we remove the redundant code here, substantially simplifying `handle_chan_restoration_locked` while we're at it.
There is no reason anymore for `handle_chan_restoration_locked` to be a macro, and our long-term desire is to move away from macros as they substantially bloat our compilation time (and binary size). Thus, we simply remove `handle_chan_restoration_locked` here and turn it into a function.
755f15c to
f1c6cd8
Compare
Codecov ReportBase: 90.61% // Head: 90.70% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1859 +/- ##
==========================================
+ Coverage 90.61% 90.70% +0.09%
==========================================
Files 90 90
Lines 47623 47552 -71
Branches 47623 47552 -71
==========================================
- Hits 43152 43132 -20
+ Misses 4471 4420 -51
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Contributor
valentinewallace
left a comment
There was a problem hiding this comment.
Otherwise LGTM I think
Now that `handle_channel_resumption` can't fail, the error handling in `post_handle_chan_restoration` is now dead code. Removing it makes `post_handle_chan_restoration` only a single block, so here we simply remove the macro and inline the single block into the two places the macro was used.
valentinewallace
approved these changes
Nov 21, 2022
wpaulino
approved these changes
Nov 21, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

When we process a
channel_reestablishmessage we free the HTLCupdate holding cell as things may have changed while we were
disconnected. However, some time ago, to handle freeing from the
holding cell when a monitor update completes, we added a holding
cell freeing check in
get_and_clear_pending_msg_events. Thisleaves the in-
channel_reestablishholding cell clear redundant,as doing it immediately or is
get_and_clear_pending_msg_eventsisnot a user-visible difference.
Thus, we remove the redundant code here, substantially simplifying
handle_chan_restoration_lockedwhile we're at it.