Skip to content

Restore debug assertion removed due to lockorder restrictions #3943

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

TheBlueMatt
Copy link
Collaborator

In 4582b20 we removed a debug assertion which tested that channels seeing HTLC claim replays on startup would be properly unblocked by later monitor update completion in the downstream chanel.

We did so because we couldn't pass our lockorder tests taking a per_peer_state read lock to check if a channel was closed while the a per_peer_state read lock was already held.

However, there's no actual reason for that, its just an arbitrary restriction of our lockorder tests.

Here we restore the removed debug assertion by simply enabling the skipping of lockorder checking in #[cfg(test)] code - we don't care if there's a theoretical deadlock in test-only code as long as none of our tests actually hit it.

Note that we also take this opportunity to enable deadlock detection in no-std tests as even #[cfg(not(feature = "std"))] test builds allow access to std.

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jul 19, 2025

I've assigned @jkczyz as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@TheBlueMatt TheBlueMatt force-pushed the 2024-09-async-persist-claiming-from-closed-chan branch from 6bf3be6 to d5e20fb Compare July 19, 2025 19:26
@ldk-reviews-bot ldk-reviews-bot requested a review from jkczyz July 19, 2025 19:34
@TheBlueMatt TheBlueMatt force-pushed the 2024-09-async-persist-claiming-from-closed-chan branch 2 times, most recently from 4a71e77 to f2d885a Compare July 19, 2025 19:44
In 4582b20 we removed a debug
assertion which tested that channels seeing HTLC claim replays on
startup would be properly unblocked by later monitor update
completion in the downstream chanel.

We did so because we couldn't pass our lockorder tests taking a
`per_peer_state` read lock to check if a channel was closed while
the a `per_peer_state` read lock was already held.

However, there's no actual reason for that, its just an arbitrary
restriction of our lockorder tests.

Here we restore the removed debug assertion by simply enabling the
skipping of lockorder checking in `#[cfg(test)]` code - we don't
care if there's a theoretical deadlock in test-only code as long as
none of our tests actually hit it.

Note that we also take this opportunity to enable deadlock
detection in `no-std` tests as even `#[cfg(not(feature = "std"))]`
test builds allow access to `std`.
@TheBlueMatt TheBlueMatt force-pushed the 2024-09-async-persist-claiming-from-closed-chan branch from f2d885a to eadb70f Compare July 20, 2025 00:04
Copy link

codecov bot commented Jul 20, 2025

Codecov Report

Attention: Patch coverage is 84.21053% with 6 lines in your changes missing coverage. Please review.

Project coverage is 89.03%. Comparing base (2f9898c) to head (eadb70f).

Files with missing lines Patch % Lines
lightning/src/ln/channelmanager.rs 82.75% 4 Missing and 1 partial ⚠️
lightning/src/sync/debug_sync.rs 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3943      +/-   ##
==========================================
- Coverage   89.05%   89.03%   -0.02%     
==========================================
  Files         167      167              
  Lines      121800   121847      +47     
  Branches   121800   121847      +47     
==========================================
+ Hits       108464   108482      +18     
- Misses      10928    10949      +21     
- Partials     2408     2416       +8     
Flag Coverage Δ
fuzz 22.73% <ø> (-0.36%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants