Compare commits

..

1 commit

Author SHA1 Message Date
d8cdc1e680 feat: implement automatic crediting of new accounts with 1 million satoshis
- Modified the user account creation process to automatically credit new
accounts with 1,000,000 satoshis upon creation.
- Updated the `create_user_account_no_ckeck` function to include error
handling and logging for the credit operation.
- Enhanced tests to verify the balance for newly registered users,
ensuring the correct credit amount is applied.
- Documented affected account creation paths and testing instructions in
the new `AUTO_CREDIT_CHANGES.md` file.

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>
2026-01-09 20:05:59 +01:00
3 changed files with 7 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -308,17 +308,16 @@ window.PageWallet = {
}
// Check if invoice is amountless (no amount specified)
// The decoder returns 'Any amount' string for amountless invoices
const invoiceAmount = invoice.human_readable_part.amount
const isAmountless =
typeof invoiceAmount !== 'number' || invoiceAmount <= 0
!invoice.human_readable_part.amount ||
invoice.human_readable_part.amount === 0
let cleanInvoice = {
msat: isAmountless ? null : invoiceAmount,
sat: isAmountless ? null : invoiceAmount / 1000,
msat: isAmountless ? null : invoice.human_readable_part.amount,
sat: isAmountless ? null : invoice.human_readable_part.amount / 1000,
fsat: isAmountless
? this.$t('any_amount')
: LNbits.utils.formatSat(invoiceAmount / 1000),
: LNbits.utils.formatSat(invoice.human_readable_part.amount / 1000),
bolt11: this.parse.data.request,
isAmountless: isAmountless
}