Add Lightning amount threshold validation
This commit is contained in:
parent
28e8ba218f
commit
8936d802a6
3 changed files with 87 additions and 0 deletions
|
|
@ -33,6 +33,7 @@ from shared_constants import (
|
|||
EUR_TRADE_INCREMENT,
|
||||
EUR_TRADE_MAX,
|
||||
EUR_TRADE_MIN,
|
||||
LIGHTNING_MAX_EUR,
|
||||
PREMIUM_PERCENTAGE,
|
||||
PRICE_STALENESS_SECONDS,
|
||||
SLOT_DURATION_MINUTES,
|
||||
|
|
@ -415,6 +416,20 @@ async def create_exchange(
|
|||
detail=f"EUR amount must be a multiple of €{EUR_TRADE_INCREMENT}",
|
||||
)
|
||||
|
||||
# Validate Lightning threshold
|
||||
if (
|
||||
bitcoin_transfer_method == BitcoinTransferMethod.LIGHTNING
|
||||
and request.eur_amount > LIGHTNING_MAX_EUR * 100
|
||||
):
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail=(
|
||||
f"Lightning payments are only allowed for amounts up to "
|
||||
f"€{LIGHTNING_MAX_EUR}. For amounts above €{LIGHTNING_MAX_EUR}, "
|
||||
"please use onchain transactions."
|
||||
),
|
||||
)
|
||||
|
||||
# Validate slot timing - compute valid boundaries from slot duration
|
||||
valid_minutes = tuple(range(0, 60, SLOT_DURATION_MINUTES))
|
||||
if request.slot_start.minute not in valid_minutes:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue