server: correctly convert invoice features #145
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
New imports added:
src/server.rs
: ImportedBlindedHopFeatures
andBolt12InvoiceFeatures
from thelightning::ln::features
module. This change suggests that these types will be used in the codebase, likely for feature conversion.Changes in function parameters:
src/server.rs
: In thegenerate_bolt12_invoice_contents
function, thefeatures
parameter now uses theconvert_invoice_features
function instead ofconvert_features
. This change indicates a shift in how invoice features are being converted.src/server.rs
: In theconvert_blinded_pay_info
function, thefeatures
parameter now uses theconvert_hop_features
function instead ofconvert_features
. This change suggests a new approach to converting hop features.Replacement of feature conversion logic:
src/server.rs
: The previous genericconvert_features
function and thefeature_bit_from_id
function have been removed. Instead, two new conversion functions,convert_invoice_features
andconvert_hop_features
, have been introduced. These changes indicate a move towards more specific feature conversion functions, likely for better accuracy and maintainability.