mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-18 12:11:35 +00:00
Implement max public orders limit
This commit is contained in:
parent
67a108e0ac
commit
fba6749500
@ -58,6 +58,9 @@ PENALTY_TIMEOUT = 60
|
||||
# Time between routing attempts of buyer invoice in MINUTES
|
||||
RETRY_TIME = 5
|
||||
|
||||
# Platform activity limits
|
||||
MAX_PUBLIC_ORDERS = 100
|
||||
|
||||
# Trade limits in satoshis
|
||||
MIN_TRADE = 10000
|
||||
MAX_TRADE = 500000
|
||||
|
10
api/views.py
10
api/views.py
@ -55,6 +55,16 @@ class MakerView(CreateAPIView):
|
||||
if not serializer.is_valid():
|
||||
return Response(status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
# In case it gets overwhelming. Limit the number of public orders.
|
||||
if Order.objects.filter(status=Order.Status.PUB).count() >= int(config("MAX_PUBLIC_ORDERS")):
|
||||
return Response(
|
||||
{
|
||||
"bad_request":
|
||||
"Woah! RoboSats' book is at full capacity! Try again later"
|
||||
},
|
||||
status.HTTP_400_BAD_REQUEST,
|
||||
)
|
||||
|
||||
type = serializer.data.get("type")
|
||||
currency = serializer.data.get("currency")
|
||||
amount = serializer.data.get("amount")
|
||||
|
Loading…
Reference in New Issue
Block a user