diff --git a/cashu/core/db.py b/cashu/core/db.py index b96750f5..2a575dde 100644 --- a/cashu/core/db.py +++ b/cashu/core/db.py @@ -206,9 +206,9 @@ def _is_lock_exception(e): session: AsyncSession = self.async_session() # type: ignore try: logger.trace(f"Connecting to database trial: {trial} ({random_int})") - async with session.begin(): # type: ignore + async with session.begin() as txn: # type: ignore logger.trace("Connected to database. Starting transaction") - wconn = Connection(session, None, self.type, self.name, self.schema) + wconn = Connection(session, txn, self.type, self.name, self.schema) if lock_table: await self.acquire_lock( wconn, lock_table, lock_select_statement diff --git a/tests/conftest.py b/tests/conftest.py index e9ca102e..3a0ce2b9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -92,7 +92,7 @@ async def start_mint_init(ledger: Ledger) -> Ledger: # drop all tables await conn.execute("DROP SCHEMA public CASCADE;") await conn.execute("CREATE SCHEMA public;") - await db.engine.dispose() + # await db.engine.dispose() wallets_module = importlib.import_module("cashu.lightning") lightning_backend_sat = getattr(wallets_module, settings.mint_backend_bolt11_sat)(