diff --git a/validation.py b/validation.py index 68f6331..e67b662 100644 --- a/validation.py +++ b/validation.py @@ -231,11 +231,17 @@ def validate_transaction(payload, markets): errors["type"] = error transaction["type"] = tx_type - market_id, error = validate_market_id(data.get("market_id"), markets) - if error: - errors["market_id"] = error + 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: