Fix potential peer_state deadlocks in finish_force_close_channel#2597
Merged
TheBlueMatt merged 2 commits intolightningdevkit:mainfrom Sep 26, 2023
Merged
Conversation
dunxen
previously approved these changes
Sep 25, 2023
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #2597 +/- ##
=======================================
Coverage 88.85% 88.86%
=======================================
Files 113 113
Lines 84482 84517 +35
Branches 84482 84517 +35
=======================================
+ Hits 75069 75103 +34
+ Misses 7213 7211 -2
- Partials 2200 2203 +3
☔ View full report in Codecov by Sentry. |
Contributor
|
Feel free to squash |
`ChannelManager::finish_force_close_channel` exists to do cleanups which must happen without the `per_peer_state` mutex held. However, because it lacked lock assertions, several changes snuck in recently which resulted in it running with peer-state locks held, risking a deadlock if some HTLCs need to be failed.
We have code to handle receiving `shutdown` messages on unfudned channels. However, it had no test coverage, which we add here.
913a330 to
20e1c27
Compare
Collaborator
Author
|
Squashed. |
dunxen
approved these changes
Sep 26, 2023
wpaulino
approved these changes
Sep 26, 2023
Comment on lines
+267
to
+270
| // P2WSH | ||
| let script = Builder::new().push_int(0) | ||
| .push_slice(&[0; 20]) | ||
| .into_script(); |
Merged
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.
ChannelManager::finish_force_close_channelexists to do cleanups which must happen without theper_peer_statemutex held. However, because it lacked lock assertions, several changes snuck in recently which resulted in it running with peer-state locks held, risking a deadlock if some HTLCs need to be failed.