Skip to content

fix: apply reward routing budget to payouts#2479

Open
keshav0479 wants to merge 1 commit intoRoboSats:mainfrom
keshav0479:fix/rewards-routing-budget-payment
Open

fix: apply reward routing budget to payouts#2479
keshav0479 wants to merge 1 commit intoRoboSats:mainfrom
keshav0479:fix/rewards-routing-budget-payment

Conversation

@keshav0479
Copy link
Copy Markdown
Contributor

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_ppm to /api/reward/, but the reward LNPayment was 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 LNPayment and uses the stored routing_budget_sats when paying rewards.

I also fixed a failure path where reward payout could return plain False, but withdraw_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.py
  • git diff --check upstream/main

Checklist before merging

  • Install pre-commit and initialize it: pip install pre-commit, then pre-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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant