Skip to content
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

Claiming rewards does not support routing_budget_ppm #1382

Open
jerryfletcher21 opened this issue Jul 13, 2024 · 1 comment
Open

Claiming rewards does not support routing_budget_ppm #1382

jerryfletcher21 opened this issue Jul 13, 2024 · 1 comment

Comments

@jerryfletcher21
Copy link
Contributor

Describe the bug
The /api/order update_invoice and /api/rewards requests are similar: they accept a signed invoice to be paid by the coordinator. The amounts of the invoice are also similar, since trades ended up in a dispute will be refunded by rewards.
The first one supports the parameter routing_budget_ppm that allows the user to specify the routing budget (to be subtracted from the invoice amount), while the second one does not support it and instead uses the default of 1000 ppm or 10 sats.

in api/logics.py:
update_invoice:

routing_budget_sats = float(num_satoshis) * (
    float(routing_budget_ppm) / 1_000_000
)
num_satoshis = int(num_satoshis - routing_budget_sats)

withdraw_rewards:

num_satoshis = user.robot.earned_rewards
routing_budget_sats = int(
    max(
        num_satoshis * float(config("PROPORTIONAL_ROUTING_FEE_LIMIT")),
        float(config("MIN_FLAT_ROUTING_FEE_LIMIT_REWARD")),
    )
)  # 1000 ppm or 10 sats

Expected behavior
I think also /api/rewards should support routing_budget_ppm.
The drawback is that by supporting it, the invoice amount will change depending on the value of routing_budget_ppm, so in the main client there will have to be a similar page like for update_invoice that let changing the value of routing_budget_ppm and showing the resulting invoice amount.

@KoalaSat
Copy link
Member

Cool, people usually try first with the cheapest option, and retry other if not, but this will help for recurrent buyers if they know routing is complicated between the nodes

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

No branches or pull requests

2 participants