Skip to content

Conversation

joostjager
Copy link
Contributor

@joostjager joostjager commented Jun 24, 2025

With large reported hold times, the unit multiplication may exceed u32.

Fixes #3885

With large reported hold times, the unit multiplication may exceed u32.
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jun 24, 2025

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

@joostjager joostjager requested a review from tnull June 24, 2025 08:09
@@ -1226,7 +1226,7 @@ where
logger,
"Htlc hold time at pos {}: {} ms",
route_hop_idx,
hold_time * HOLD_TIME_UNIT_MILLIS as u32
(hold_time as u128) * HOLD_TIME_UNIT_MILLIS
Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed this would make an overflow highly unlikely, but saturating_mul would actually make it impossible. Doesn't matter much, as it's just in logging anyways.

@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 requested a review from TheBlueMatt June 24, 2025 10:44
Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

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

saturating_mul is more readable, imo, but this is fine too.

@TheBlueMatt TheBlueMatt merged commit 24063e5 into lightningdevkit:main Jun 24, 2025
28 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.

Fuzz test failure - process_onion_failure
4 participants