Skip to content

Conversation

@joostjager
Copy link
Contributor

Preparation for serializing the enum. The serialization macros do not support multiple unnamed fields.

For enums values with >1 fields, named fields are more readable also.

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Nov 25, 2025

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

InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::FailRelay(_)) =>
Some(InboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFail),
InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::FailMalformed(_)) =>
InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::FailMalformed{..}) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: All of these are lacking some whitespace, i.e.:

Suggested change
InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::FailMalformed{..}) =>
InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::FailMalformed{ .. }) =>

But that's non-blocking given that rustfmt will fix that for us eventually.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added rustfmt commit to clean up to avoid "eventually" 😂

FailRelay(msgs::OnionErrorPacket),
FailMalformed(([u8; 32], u16)),
Fulfill(PaymentPreimage, Option<AttributionData>),
FailMalformed { hash: [u8; 32], code: u16 },
Copy link
Contributor

@tnull tnull Nov 25, 2025

Choose a reason for hiding this comment

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

Given we use sha256_of_onion in the message below, should we use that more-descriptive field name instead of hash here, too? Or would it be inaccurate?

Also maybe failure_code rather than code to be consistent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, better indeed. Updated

Copy link
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.

See question above, otherwise LGTM

@tnull tnull removed the request for review from jkczyz November 25, 2025 08:23
@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

❌ Patch coverage is 86.66667% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.33%. Comparing base (bb5504e) to head (8116e0b).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/channel.rs 86.66% 16 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4243   +/-   ##
=======================================
  Coverage   89.33%   89.33%           
=======================================
  Files         180      180           
  Lines      138680   138730   +50     
  Branches   138680   138730   +50     
=======================================
+ Hits       123888   123938   +50     
- Misses      12172    12174    +2     
+ Partials     2620     2618    -2     
Flag Coverage Δ
fuzzing 35.02% <60.74%> (-0.97%) ⬇️
tests 88.70% <85.92%> (+<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.

Preparation for serializing the enum. The serialization macros do not
support multiple unnamed fields.
Clean up changes in previous commits.
Copy link
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

Simple refactor, landing this.

@ldk-reviews-bot
Copy link

👋 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 fe5d942 into lightningdevkit:main Nov 26, 2025
26 checks passed
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.

3 participants