Require a destination for a sats transfer only
This commit is contained in:
1 parent
0d31ad7250
commit
bda3db46f6
1 file changed
+14
-7
+14
-7
@@ -291,13 +291,20 @@ def validate_transaction(payload, markets):
|
||||
if name not in _ALLOWED_LEGS.get(tx_type, ()):
|
||||
errors[name] = "Feltet høyrer ikkje til denne typen."
|
||||
if tx_type == "transfer_out":
|
||||
to_market_id, error = validate_market_id(
|
||||
data.get("to_market_id"), markets, "to_market_id"
|
||||
)
|
||||
if error:
|
||||
errors["to_market_id"] = error
|
||||
elif to_market_id == market_id:
|
||||
errors["to_market_id"] = "Overføringa må gå til ein annan konto."
|
||||
_check_transfer_out(legs, errors)
|
||||
# An empty destination is a withdrawal, and only kroner can be
|
||||
# withdrawn (docs/spec.md section 3.11).
|
||||
if _blank(data.get("to_market_id")):
|
||||
if legs["leg_out_ore"] is None:
|
||||
errors["to_market_id"] = "Ei overføring i sats må ha ein mottakar."
|
||||
else:
|
||||
to_market_id, error = validate_market_id(
|
||||
data.get("to_market_id"), markets, "to_market_id"
|
||||
)
|
||||
if error:
|
||||
errors["to_market_id"] = error
|
||||
elif to_market_id == market_id:
|
||||
errors["to_market_id"] = "Overføringa må gå til ein annan konto."
|
||||
_check_fee(legs, tx_type, errors)
|
||||
|
||||
transaction["leg_in_sats"] = legs["leg_in_sats"]
|
||||
|
||||
Reference in new issue
Block a user