From 495dc6b53f4e261966e5ca67e856e30522d783bf Mon Sep 17 00:00:00 2001 From: shroominic <34897716+shroominic@users.noreply.github.com> Date: Fri, 6 Jun 2025 12:06:51 +0200 Subject: [PATCH] Remove redundant wallet initialization --- router/auth.py | 6 ++++-- router/cashu.py | 2 ++ tests/test_account.py | 2 ++ tests/test_main.py | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/router/auth.py b/router/auth.py index a6010c78..22b66cf0 100644 --- a/router/auth.py +++ b/router/auth.py @@ -71,8 +71,10 @@ async def validate_bearer_key( key_expiry_time=key_expiry_time, ) await credit_balance( - bearer_key, new_key, session - ) # TODO: see cashu.py "_initialize_wallet" + bearer_key, + new_key, + session, + ) await session.refresh(new_key) return new_key except Exception as e: diff --git a/router/cashu.py b/router/cashu.py index c56437bc..12adf077 100644 --- a/router/cashu.py +++ b/router/cashu.py @@ -25,6 +25,8 @@ async def close_wallet(): global WALLET await WALLET.aclose() + + async def pay_out() -> None: """ Calculates the pay-out amount based on the spent balance, profit, and donation rate. diff --git a/tests/test_account.py b/tests/test_account.py index 164daff3..6fb832b2 100644 --- a/tests/test_account.py +++ b/tests/test_account.py @@ -203,3 +203,5 @@ async def test_account_with_cashu_token( # Check that a new key was created with the hashed token assert data["api_key"].startswith("sk-") assert data["balance"] >= 0 # Balance should be set after credit_balance + + diff --git a/tests/test_main.py b/tests/test_main.py index cee18b37..d4d026ca 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -56,4 +56,4 @@ async def test_startup_event_initializes_properly(test_client): # The test_client fixture already triggers the startup event # This test ensures no exceptions are raised during startup response = test_client.get("/") - assert response.status_code == 200 \ No newline at end of file + assert response.status_code == 200