Update constants validation to check bitcoinTransferMethods and lightningMaxEur

This commit is contained in:
counterweight 2025-12-23 14:26:24 +01:00
parent 819bb2dd03
commit cecb8b33a7
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C

View file

@ -6,6 +6,7 @@ from pathlib import Path
from models import (
ROLE_ADMIN,
ROLE_REGULAR,
BitcoinTransferMethod,
ExchangeStatus,
InviteStatus,
TradeDirection,
@ -59,6 +60,15 @@ def validate_shared_constants() -> None:
f"Expected: {expected_trade_directions}, Got: {got}"
)
# Validate bitcoin transfer methods
expected_transfer_methods = {m.name: m.value for m in BitcoinTransferMethod}
if constants.get("bitcoinTransferMethods") != expected_transfer_methods:
got = constants.get("bitcoinTransferMethods")
raise ValueError(
f"Bitcoin transfer method mismatch. "
f"Expected: {expected_transfer_methods}, Got: {got}"
)
# Validate exchange constants exist with required fields
exchange = constants.get("exchange", {})
required_exchange_fields = [
@ -71,6 +81,7 @@ def validate_shared_constants() -> None:
"premiumPercentage",
"priceRefreshSeconds",
"priceStalenessSeconds",
"lightningMaxEur",
]
for field in required_exchange_fields:
if field not in exchange: