Skip to content

Fix reward routing budget payouts - #2511

Open
caydyan wants to merge 1 commit into
RoboSats:mainfrom
caydyan:codex/reward-routing-budget-1382
Open

Fix reward routing budget payouts#2511
caydyan wants to merge 1 commit into
RoboSats:mainfrom
caydyan:codex/reward-routing-budget-1382

Conversation

@caydyan

@caydyan caydyan commented Jun 14, 2026

Copy link
Copy Markdown

Summary

Fixes #1382. Reward withdrawals now carry the selected routing budget through the whole payout path instead of validating against one budget and paying with the default fee cap.

Changes:

  • Store routing_budget_ppm and routing_budget_sats on reward withdrawal LNPayment rows.
  • Use the stored reward payout routing budget in both LND and CLN reward pay_invoice() calls, with legacy fallback for old rows that have no stored budget.
  • Restore the original reward balance if a custom-budget reward payment fails, instead of restoring only the reduced invoice amount.
  • Extend the unilateral-cancel reward withdrawal test to use a non-zero routing budget and assert the stored payout amount/budget.

Validation

Passed locally:

  • python3 -m py_compile api/logics.py api/lightning/lnd.py api/lightning/cln.py tests/test_trade_pipeline.py
  • git diff --check
  • /tmp/robosats-1382-venv/bin/python -m ruff check api/logics.py api/lightning/lnd.py api/lightning/cln.py tests/test_trade_pipeline.py

Attempted focused Django test:

  • python3 manage.py test tests.test_trade_pipeline.TradeTest.test_withdraw_reward_after_unilateral_cancel_routing_budget --verbosity=2

That was blocked before test startup because the local Python environment did not have Django installed. I then created a Python 3.12 venv, but full requirements installation was blocked by psycopg2==2.9.10 needing pg_config, which is not available on this machine.

BTC payout address if this is accepted for the sats reward: bc1qev5ant33v5y89qqjvcf4mh9hlax5svqf5xd7gc

@caydyan

caydyan commented Jun 14, 2026

Copy link
Copy Markdown
Author

CI note: the Python linter passed on this head, but the coordinator test workflow failed before running any tests.

Failure is in Download static files Artifact:

no downloadable artifacts found (expired) for django-main-static from frontend-build.yml run 21478603168 dated 2026-01-29. That artifact expired on 2026-04-29.

So the LND/CLN coordinator tests did not reach Docker orchestration or Django test execution on this PR head. Local validation still passed py_compile, diff check, and targeted ruff; local focused Django test remains blocked by missing pg_config for psycopg2 installation on this machine.

Likely unblock: a maintainer needs to dispatch Build: Frontend All Bundles on an upstream RoboSats branch (or update the coordinator test workflow to build/use a fresh django-main-static artifact). Runs from forks are skipped by the current allow_forks: false artifact lookup, so I am not pushing an unrelated frontend-only change to this Python fix PR.

@caydyan
caydyan marked this pull request as ready for review June 14, 2026 23:37
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.

Claiming rewards does not support routing_budget_ppm

1 participant