fix: apply reward routing budget to payouts#2479
Open
keshav0479 wants to merge 1 commit intoRoboSats:mainfrom
Open
fix: apply reward routing budget to payouts#2479keshav0479 wants to merge 1 commit intoRoboSats:mainfrom
keshav0479 wants to merge 1 commit intoRoboSats:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
Related to #1382
Follow-up to #2038 and #2364
While rebasing #2364, I looked at the reward backend path again.
#2038 added
routing_budget_ppmto/api/reward/, but the rewardLNPaymentwas not storing the budget fields. So the invoice amount could be checked with the submitted budget, while the actual LND/CLN reward payout still used the default reward fee cap.This stores the reward budget on the
LNPaymentand uses the storedrouting_budget_satswhen paying rewards.I also fixed a failure path where reward payout could return plain
False, butwithdraw_rewards()expected(paid, failure_reason). In that case the reward balance had already been cleared, so now it returns a normal invoice error and restores the original reward balance.Tested:
./venv/bin/python manage.py test api.tests.test_logics --verbosity 2./venv/bin/ruff check api/logics.py api/serializers.py api/lightning/lnd.py api/lightning/cln.py api/tests/test_logics.pygit diff --check upstream/mainChecklist before merging
pip install pre-commit, thenpre-commit install. Pre-commit installs git hooks that automatically check the codebase. If pre-commit fails when you commit your changes, please fix the problems it points out.