Skip to content
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

Invoice utils: allow to set both description hash and payment hash #3371

Conversation

tnull
Copy link
Contributor

@tnull tnull commented Oct 16, 2024

I discovered we had no API method to specify both the description hash and the payment hash at the same time.

Here, we add such a helper method, although mid-term we probably should move to a different pattern here (builder?) as the current way is rather inflexible and the method names get ridiculously long.

Copy link

codecov bot commented Oct 16, 2024

Codecov Report

Attention: Patch coverage is 0% with 27 lines in your changes missing coverage. Please review.

Project coverage is 89.59%. Comparing base (6004ee5) to head (43fd78b).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/invoice_utils.rs 0.00% 27 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3371      +/-   ##
==========================================
- Coverage   89.62%   89.59%   -0.04%     
==========================================
  Files         127      127              
  Lines      103534   103762     +228     
  Branches   103534   103762     +228     
==========================================
+ Hits        92797    92963     +166     
- Misses       8038     8105      +67     
+ Partials     2699     2694       -5     

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

@jkczyz jkczyz self-requested a review October 16, 2024 15:22
.map_err(|()| SignOrCreationError::CreationError(CreationError::InvalidAmount))?;
_create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(
channelmanager, node_signer, logger, network, amt_msat,
Bolt11InvoiceDescription::Hash(&description_hash),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't recall if there was a reason why we can't take Bolt11InvoiceDescription as a parameter instead.

Copy link
Contributor Author

@tnull tnull Oct 16, 2024

Choose a reason for hiding this comment

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

I assume the lifetimes don't lend themselves to being exposed in bindings?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, right. Though an owned version would work, I suppose. No need to do it in this PR.

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.

We really need to replace this garbage with some kind of config struct/builder pattern so its not a total mess. #3375

@TheBlueMatt TheBlueMatt merged commit 4a7b01a into lightningdevkit:main Oct 17, 2024
20 of 21 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