Let admin_cost have no account and check the type rules in order

This commit is contained in:
ai-bot committed 2026-11-14 18:01:26 +00:00
1 parent e6b07afd2a
commit fbfbbd168e
1 file changed
+6
+6
View File
@@ -231,11 +231,17 @@ def validate_transaction(payload, markets):
errors["type"] = error
transaction["type"] = tx_type
market_id = None
if tx_type == "admin_cost":
# admin_cost stands on its own, so there is no account to look up.
market_id = None
else:
market_id, error = validate_market_id(data.get("market_id"), markets)
if error:
errors["market_id"] = error
transaction["market_id"] = market_id
# The flag defaults from the account; admin_cost has none, so it defaults to 1.
account = markets.get(market_id) if market_id is not None else None
taxable = _boolean(data.get("taxable"), account["taxable"] if account else 1)
if taxable is None: