Skip to content

Conversation

@psychemist
Copy link

@psychemist psychemist commented Dec 26, 2025

This change updatesBolt11Invoice's payment_hash function's return type from a stream of bytes (sha256 digest) to PaymentHash, which is now a valid type in lightning_types. Also, tests and other functions that called the function were refactored to reflect that modification.

Closes #4292

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Dec 26, 2025

I've assigned @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.

@codecov
Copy link

codecov bot commented Dec 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.36%. Comparing base (62c5849) to head (51fc781).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4293      +/-   ##
==========================================
- Coverage   89.38%   89.36%   -0.02%     
==========================================
  Files         180      180              
  Lines      139834   139834              
  Branches   139834   139834              
==========================================
- Hits       124985   124958      -27     
- Misses      12262    12284      +22     
- Partials     2587     2592       +5     
Flag Coverage Δ
fuzzing 36.18% <0.00%> (+0.97%) ⬆️
tests 88.70% <100.00%> (-0.02%) ⬇️

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
Contributor

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

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

I did a pass of this PR, and the git history can be squashed into a single message that includes also a small line for the potential breaking change that this PR is introducing.

In addition, if changing to by-value return is what we want, do you think that we should consider updating payment_secret() as well for consistency (perhaps in a follow-up PR, or expand this one's scope).

cltv_expiry_delta,
payment_size_msat,
"asdf",
"e2e",
Copy link
Contributor

Choose a reason for hiding this comment

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

This is unrelated to the PR's stated purpose. Why we need this change?

*intercept_id,
*expected_outbound_amount_msat,
PaymentHash(invoice.payment_hash().to_byte_array()),
PaymentHash(invoice.payment_hash().0),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we not just passing the invoice.payment_hash()?

*intercept_id,
*expected_outbound_amount_msat,
PaymentHash(invoice.payment_hash().to_byte_array()),
PaymentHash(invoice.payment_hash().0),
Copy link
Contributor

Choose a reason for hiding this comment

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

same here and in other several places

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.

Bolt11Invoice::payment_hash should return a PaymentHash

3 participants