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

server: correctly convert invoice features #145

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

mrfelton
Copy link
Contributor

There is probably a better way to do this, but this does resolve the issue and ensures that the feature bits returned when fetching/decoding an invoice correctly match those set in the invoice.


This pull request primarily focuses on refactoring the feature conversion logic in the src/server.rs file of the project. The changes include the addition of new imports, modifying function parameters, and replacing previous feature conversion logic with new, more specific conversion functions.

Here are the key changes:

  1. New imports added:

    • src/server.rs: Imported BlindedHopFeatures and Bolt12InvoiceFeatures from the lightning::ln::features module. This change suggests that these types will be used in the codebase, likely for feature conversion.
  2. Changes in function parameters:

    • src/server.rs: In the generate_bolt12_invoice_contents function, the features parameter now uses the convert_invoice_features function instead of convert_features. This change indicates a shift in how invoice features are being converted.
    • src/server.rs: In the convert_blinded_pay_info function, the features parameter now uses the convert_hop_features function instead of convert_features. This change suggests a new approach to converting hop features.
  3. Replacement of feature conversion logic:

    • src/server.rs: The previous generic convert_features function and the feature_bit_from_id function have been removed. Instead, two new conversion functions, convert_invoice_features and convert_hop_features, have been introduced. These changes indicate a move towards more specific feature conversion functions, likely for better accuracy and maintainability.

Copy link

codecov bot commented Jul 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (25e3e2d) to head (16f520f).

Additional details and impacted files
@@          Coverage Diff           @@
##           master    #145   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files           1       1           
  Lines          97      97           
======================================
  Misses         97      97           

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

@mrfelton mrfelton force-pushed the fix/features branch 2 times, most recently from 64d708d to 1ee967e Compare July 24, 2024 11:33
@orbitalturtle orbitalturtle self-requested a review July 24, 2024 20:39
@orbitalturtle
Copy link
Collaborator

@mrfelton Nice! I'll take a look this evening.

@orbitalturtle orbitalturtle added this to the 0.2.0 milestone Jul 24, 2024
@orbitalturtle
Copy link
Collaborator

@mrfelton Looks like this needs a rebase since I just merged another PR. But looks good to me once that's done.

@mrfelton
Copy link
Contributor Author

mrfelton commented Aug 5, 2024

Rebased

@orbitalturtle orbitalturtle merged commit d69aecc into lndk-org:master Aug 6, 2024
10 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.

2 participants