Check the admin cost legs and the sats-only fee

This commit is contained in:
ai-bot committed 2026-11-15 10:33:59 +00:00
1 parent 51186c3b4d
commit 06e550771c
1 file changed
+6 -10
+6 -10
View File
@@ -194,19 +194,15 @@ def _check_trade(legs, errors):
def _check_admin_cost(legs, errors): def _check_admin_cost(legs, errors):
"""admin_cost takes sats only and stands on its own (docs/spec.md section 3.10).""" """admin_cost is a kroner cost and stands on its own (docs/spec.md section 3.10)."""
if legs["leg_out_sats"] is None or legs["leg_out_ore"] is not None: if legs["leg_out_ore"] is None or legs["leg_out_sats"] is not None:
errors["leg_out_sats"] = "Fyll ut kostnaden i sats." errors["leg_out_sats"] = "Fyll ut kostnaden i kroner."
def _check_fee(legs, tx_type, errors): def _check_fee(legs, tx_type, errors):
if tx_type in NO_FEE_TYPES: """A fee is in sats only (docs/spec.md section 3.2)."""
for name in ("fee_sats", "fee_ore"): if legs["fee_sats"] is not None and tx_type in NO_FEE_TYPES:
if legs[name] is not None: errors["fee_sats"] = "Denne typen tek ikkje avgift."
errors[name] = "Denne typen tek ikkje avgift."
return
if legs["fee_sats"] is not None and legs["fee_ore"] is not None:
errors["fee_ore"] = "Avgifta kan berre førast i éin valuta."
return return
fee_sats = legs["fee_sats"] or 0 fee_sats = legs["fee_sats"] or 0
if not fee_sats: if not fee_sats: