Skip to content

Add FilesystemStoreV2Error for v1 data detection#4573

Merged
tnull merged 1 commit intolightningdevkit:mainfrom
benthecarman:fs-store-err
Apr 22, 2026
Merged

Add FilesystemStoreV2Error for v1 data detection#4573
tnull merged 1 commit intolightningdevkit:mainfrom
benthecarman:fs-store-err

Conversation

@benthecarman
Copy link
Copy Markdown
Contributor

FilesystemStoreV2::new previously returned io::Error with ErrorKind::InvalidData when the data directory contained top-level files left behind by FilesystemStore (v1). That forced us to match on an error that could potentially be given by our normal io calls. This adds a dedicated FilesystemStoreV2Error enum with a V1DataDetected(PathBuf) so we can distinguish between normal io errors and an old V1 fs store.

suggested from: lightningdevkit/ldk-node#872 (comment)

FilesystemStoreV2::new previously returned io::Error with
ErrorKind::InvalidData when the data directory contained top-level
files left behind by FilesystemStore (v1). That forced us to
match on an error that could potentially be given by our normal io
calls. This adds a dedicated FilesystemStoreV2Error enum with a
V1DataDetected(PathBuf) so we can distinguish between normal io
errors and an old V1 fs store.
@benthecarman benthecarman requested a review from tnull April 21, 2026 18:55
@ldk-reviews-bot
Copy link
Copy Markdown

ldk-reviews-bot commented Apr 21, 2026

👋 Thanks for assigning @tnull 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.

@ldk-claude-review-bot
Copy link
Copy Markdown
Collaborator

I've reviewed the entire diff carefully. The change is well-scoped: it introduces a dedicated FilesystemStoreV2Error enum to replace the generic io::Error with ErrorKind::InvalidData, the Display/Error/From implementations are correct, the constructor properly uses ? for io::Error propagation via the From impl, and the test is updated to match on the specific enum variant rather than the error kind.

No issues found.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

❌ Patch coverage is 20.00000% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.02%. Comparing base (5079a0b) to head (6112521).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
lightning-persister/src/fs_store/v2.rs 20.00% 16 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4573   +/-   ##
=======================================
  Coverage   87.01%   87.02%           
=======================================
  Files         161      161           
  Lines      108972   108979    +7     
  Branches   108972   108979    +7     
=======================================
+ Hits        94827    94836    +9     
+ Misses      11660    11657    -3     
- Partials     2485     2486    +1     
Flag Coverage Δ
fuzzing-fake-hashes 30.82% <0.00%> (-0.01%) ⬇️
fuzzing-real-hashes 22.66% <0.00%> (+<0.01%) ⬆️
tests 86.13% <20.00%> (+<0.01%) ⬆️

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.

Copy link
Copy Markdown
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

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

LGTM

@ldk-reviews-bot
Copy link
Copy Markdown

👋 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.

@tnull tnull merged commit 2313bd5 into lightningdevkit:main Apr 22, 2026
24 of 25 checks passed
@benthecarman benthecarman deleted the fs-store-err branch April 22, 2026 13:05
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.

4 participants