From c1ada39278323c11f884d9a5a498dbb3c25ece46 Mon Sep 17 00:00:00 2001 From: 9qeklajc Date: Wed, 1 Apr 2026 17:17:36 +0200 Subject: [PATCH] refund only when reserved balance is zero --- routstr/balance.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/routstr/balance.py b/routstr/balance.py index e63f2cc3..e4384ad7 100644 --- a/routstr/balance.py +++ b/routstr/balance.py @@ -268,6 +268,12 @@ async def refund_wallet_endpoint( detail="Cannot refund child key. Please refund the parent key instead.", ) + if key.reserved_balance > 0: + raise HTTPException( + status_code=400, + detail="Cannot refund key. There are ongoing requests for this api key.", + ) + remaining_balance_msats: int = key.total_balance if key.refund_currency == "sat":