Skip to content

Claiming rewards does not support routing_budget_ppm #1382

@jerryfletcher21

Description

@jerryfletcher21

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement 🆙New feature or requestpythonPull requests that update Python code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions