From 3126338ca4c0365ec0128eafcd171d713814e252 Mon Sep 17 00:00:00 2001 From: padreug Date: Sat, 3 Jan 2026 14:23:39 +0100 Subject: [PATCH] fix: pass db connection to update_wallet_balance to prevent SQLite deadlock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The auto-credit feature was causing a deadlock on SQLite because update_wallet_balance was opening a new database connection while already inside a transaction. By passing conn=conn, we reuse the existing connection and avoid the deadlock. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- lnbits/core/services/users.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lnbits/core/services/users.py b/lnbits/core/services/users.py index 55f5c795..16d6884c 100644 --- a/lnbits/core/services/users.py +++ b/lnbits/core/services/users.py @@ -84,7 +84,7 @@ async def create_user_account_no_ckeck( # Credit new account with 1 million satoshis try: - await update_wallet_balance(wallet, 1_000_000) + await update_wallet_balance(wallet, 1_000_000, conn=conn) logger.info(f"Credited new account {account.id} with 1,000,000 sats") except Exception as e: logger.error(f"Failed to credit new account {account.id} with 1,000,000 sats: {e}")