fix: pass db connection to update_wallet_balance to prevent SQLite deadlock

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 <noreply@anthropic.com>
This commit is contained in:
padreug 2026-01-03 14:23:39 +01:00
parent 6dfa6a7723
commit 3126338ca4

View file

@ -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}")