-
Notifications
You must be signed in to change notification settings - Fork 409
Add methods to set invoice features in Features objects. #836
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
Add methods to set invoice features in Features objects. #836
Conversation
Codecov Report
@@ Coverage Diff @@
## main #836 +/- ##
==========================================
+ Coverage 90.67% 90.68% +0.01%
==========================================
Files 50 50
Lines 26828 26843 +15
==========================================
+ Hits 24326 24343 +17
+ Misses 2502 2500 -2
Continue to review full report at Codecov.
|
I don't have a problem with this approach. @TheBlueMatt Any reason not to expose these? |
Hmm, our features historically have always been "don't export the manipulation bits, just allows creation via |
I tend to like a fluent-style API for this (consuming rather than mutating) similar to what I defined in a test: |
Yea, definitely makes for cleaner rust code. I need to figure out how to properly map such things in the bindings, though, presumably via a constructor that takes a parameter for each possible function call. Gonna be hard with lightning-invoice. If it makes sense, would be nice to avoid it for a bit longer, but it may need to happen eventually anyway. |
ca33f81
to
5f8d3cc
Compare
5f8d3cc
to
52edab7
Compare
10dfe1d
to
52edab7
Compare
Wtf. Why does this keep closing. Edit: oh my changes mysteriously vanished.. fixing |
bb333fe
to
a6434fc
Compare
lightning/src/ln/features.rs
Outdated
define_feature!(1, DataLossProtect, [InitContext, NodeContext], | ||
"Feature flags for `option_data_loss_protect`."); | ||
"Feature flags for `option_data_loss_protect`.", set_supports_data_loss_protect, | ||
set_requires_data_loss_protect); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It kinda sucks that we have to pass separate names for these. Especially considering we'd have to pass two more if we want to be consistent and define the existing supports_
and requires_
predicates using macros, too. Not sure if there is a better solution, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think technically you could do a procedural macro for this, but I don't know how to use them and I don't really want to find out.
a6434fc
to
be512c2
Compare
1a2b881
to
0138c87
Compare
0138c87
to
e0c8ec5
Compare
I was struggling to get the
Vec<u5>
fromlightning-invoice
into an our-features
-compatibleVec<u8>
. This was much easier. Lmk if it makes sense.