-
Couldn't load subscription status.
- 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
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" - |
|
FWIW skimmed_fee_msat is what triggers the transition to PaymentForwarded in both lsp_trusts_client and client_trusts_lsp now, so having it as an Option reads like “skip if you want, whatever” which is misleading. making it required and forcing an explicit 0 makes its role clear and avoids that confusion IMO |
|
Alright, no too strong opinion here. It does change how we sofar thought about the API, but maybe for the better. |
Recent changes made
skimmed_fee_msata required field ofLSPS2ServiceHandler'spayment_forwardedAPI, 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 passPaymentForwardedfields on, we'll handle the appropriately internally anyways.