-
Notifications
You must be signed in to change notification settings - Fork 421
Make skimmed_fee_msat
optional in LSPS2's payment_forwarded
API
#4162
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
base: main
Are you sure you want to change the base?
Make skimmed_fee_msat
optional in LSPS2's payment_forwarded
API
#4162
Conversation
Recent changes made `skimmed_fee_msat` a required field of `LSPS2ServiceHandler`'s `payment_forwarded` API, which seemed reasonable given that the field is available since LDK 0.0.122. However, the field is of course only set post-0.0.122 when a fee was actually withheld, which makes forcing the user to `unwrap_or(0)` potentially confusing, especially since our internal logic was written so that it *can* handle non-intercept-SCID-forwarding cases. Here, we restore the previous idea of "just pass `PaymentForwarded` fields on, we'll handle the appropriately internally anyways.
👋 Thanks for assigning @TheBlueMatt as a reviewer! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4162 +/- ##
==========================================
- Coverage 88.77% 88.77% -0.01%
==========================================
Files 180 180
Lines 136622 136622
Branches 136622 136622
==========================================
- Hits 121293 121289 -4
- Misses 12517 12525 +8
+ Partials 2812 2808 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 really disagree that we can just make this an Option
. I raised it at #3838 (comment) originally, and generally don't think its okay to have an unsafe API here - if someone passes None
we really shouldn't be blindly assuming enough was paid (or that there's never enough paid depending on how the comparison works).
👋 The first review has been submitted! Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer. |
Huh, but that's exactly the point: it's not unsafe? We only update the state to |
I would still call that "unsafe" - |
Recent changes made
skimmed_fee_msat
a required field ofLSPS2ServiceHandler
'spayment_forwarded
API, which seemed reasonable given that the field is available since LDK 0.0.122.However, the field is of course only set post-0.0.122 when a fee was actually withheld, which makes forcing the user to
unwrap_or(0)
potentially confusing, especially since our internal logic was written so that it can handle non-intercept-SCID-forwarding cases. Here, we restore the previous idea of "just passPaymentForwarded
fields on, we'll handle the appropriately internally anyways.