Skip to content

Remove a user wallet on the second delete instead of returning 404 - #4150

Merged
motorina0 merged 1 commit into
lnbits:devfrom
monasco:fix-permanent-delete-wallet
Sep 14, 2026
Merged

motorina0 merged 1 commit into
lnbits:devfrom
monasco:fix-permanent-delete-wallet

Conversation

@monasco

@monasco monasco commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Deleting a user wallet the second time from the admin Users page returned 404 "Wallet does not exist." and the wallet stayed in the database as soft deleted. The lookup used the default deleted=False, so it never found the soft deleted wallet. Now the second delete removes the wallet, like the endpoint summary says.

The first delete (soft delete) does not change.

Fixes #4149

@arcbtc
arcbtc self-requested a review September 7, 2026 21:24

@arcbtc arcbtc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice spot

@codecov

codecov Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.65%. Comparing base (d941f0a) to head (7765c35).
⚠️ Report is 19 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #4150   +/-   ##
=======================================
  Coverage   66.64%   66.65%           
=======================================
  Files         163      163           
  Lines       25065    25065           
=======================================
+ Hits        16705    16707    +2     
+ Misses       8360     8358    -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@motorina0
motorina0 merged commit c7773dd into lnbits:dev Sep 14, 2026
32 checks passed
@motorina0 motorina0 added this to the 1.6.2 milestone Sep 21, 2026
UniSyncInc2212 added a commit to UniSyncInc2212/lnbits that referenced this pull request Nov 6, 2026
* Remove a user wallet on the second delete instead of returning 404 (lnbits#4150)

* Custom memo for Credit/Debit flows. (lnbits#4162)

Co-authored-by: Vlad Stan <[email protected]>

* Merge commit from fork

* Delete cliche (lnbits#4118)

* feat: asset refactor, phoenixd/sparkl2 included, add dmg (lnbits#4167)

* fix: posgres export (lnbits#4187)

* chore(deps): bump nanoid from 3.3.16 to 3.3.19 (lnbits#4181)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: paid install QR code never shown for WASM extensions with permissions (lnbits#4195)

Co-authored-by: bitkarrot <[email protected]>

* feat: support sending to BOLT12 offers (lnbits#2581)

Pay lno1 offers through the existing /api/v1/payments path. Offers are
validated fail-closed, require an explicit sat amount, and reuse the
BOLT11 external-payment lock/fee-reserve/timeout flow instead of a
parallel pay path.

CLN and CLN REST fetch an invoice then pay it; Phoenixd and Eclair use
payoffer. Unsupported funding sources are rejected before a payment row
is created.

Co-authored-by: UniSyncInc2212 <[email protected]>

* test: start app fixture for BOLT12 payment tests

Request the session app fixture so isolated pytest runs migrate the
database before paying offers.

Co-authored-by: UniSyncInc2212 <[email protected]>

* fix: address BOLT12 send review notes

Move EclairWallet private helpers to the bottom of the class, document
the unique placeholder payment hash for reusable offers, add Feature.bolt12
and pay_offer on LNbitsWallet, disable Pay when offer amount is 0, and
name supported BOLT12 funding sources in the error and docs.

Co-authored-by: UniSyncInc2212 <[email protected]>

* fix: disable BOLT12 Pay using the amount field directly

Bind q-btn disable to parse.data.amount so a zero offer amount cannot
submit, and skip payInvoice when the offer amount is missing.

Co-authored-by: UniSyncInc2212 <[email protected]>

* fix: render a statically disabled Pay button when offer amount is 0

Use a separate always-disabled q-btn when bolt12AmountMissing so the
control cannot submit, instead of binding disable with a greater-than
expression in the in-DOM template.

Co-authored-by: UniSyncInc2212 <[email protected]>

* Squashed commit of the following:

commit d2a4e66
Author: Vlad Stan <[email protected]>
Date:   Wed Sep 16 13:21:35 2026 +0300

    refactor: extract check

commit d3423c3
Author: Vlad Stan <[email protected]>
Date:   Wed Sep 16 13:00:01 2026 +0300

    refactor: extract `_pay_from_wallet`

commit 1a868bb
Author: Vlad Stan <[email protected]>
Date:   Wed Sep 16 12:41:08 2026 +0300

    fix: param name

commit 96568e3
Author: Vlad Stan <[email protected]>
Date:   Wed Sep 16 12:25:53 2026 +0300

    refactor: extract validation

* refactor: move bolt12 logic to utils

* refactor: use payment_request for invoice and offer inputs

* test: add bot12 regtest

commit 4cb82a6
Author: alan <[email protected]>
Date:   Thu Sep 17 07:45:01 2026 +0000

    chore: make bundle [skip ci]

commit 010ef37
Author: Vlad Stan <[email protected]>
Date:   Thu Sep 17 10:35:34 2026 +0300

    fix: more fee rate fixes

commit b7f40d6
Author: Vlad Stan <[email protected]>
Date:   Thu Sep 17 10:30:38 2026 +0300

    test: fix feerate

commit 63066f8
Author: Vlad Stan <[email protected]>
Date:   Thu Sep 17 10:24:05 2026 +0300

    test: partial eclair regtest fix

commit fdbcd98
Author: Vlad Stan <[email protected]>
Date:   Thu Sep 17 09:54:33 2026 +0300

    test: fix test filter

commit 01ff9df
Author: Vlad Stan <[email protected]>
Date:   Wed Sep 16 19:37:05 2026 +0300

    test: add bolt12 regtest

* feat: add bolt12 payer_note (memo)

commit 3f80ecd
Author: Vlad Stan <[email protected]>
Date:   Fri Sep 18 11:01:28 2026 +0300

    chore: clean-up

commit af9b7ab
Author: Vlad Stan <[email protected]>
Date:   Thu Sep 17 15:30:40 2026 +0300

    feat: show offer memo and amount if present

commit b237802
Author: Vlad Stan <[email protected]>
Date:   Thu Sep 17 15:09:22 2026 +0300

    chore: make bundle

commit 5fe3cc8
Author: Vlad Stan <[email protected]>
Date:   Thu Sep 17 14:56:43 2026 +0300

    feat: show offer on ui

commit f7c7c93
Author: Vlad Stan <[email protected]>
Date:   Thu Sep 17 14:47:22 2026 +0300

    test: fix tests

commit 4f49729
Author: Vlad Stan <[email protected]>
Date:   Thu Sep 17 14:18:22 2026 +0300

    refactor: use `memo` for public api

commit 2307dfe
Author: alan <[email protected]>
Date:   Thu Sep 17 11:08:54 2026 +0000

    chore: make bundle [skip ci]

commit 5ef286b
Author: Vlad Stan <[email protected]>
Date:   Thu Sep 17 13:56:57 2026 +0300

    test: payer_note regtest

commit 3551e85
Author: Vlad Stan <[email protected]>
Date:   Thu Sep 17 13:25:29 2026 +0300

    fix: optional payer_note for eclair

commit a803991
Author: Vlad Stan <[email protected]>
Date:   Thu Sep 17 13:23:09 2026 +0300

    feat: payer_note first

* feat: save the bolt12 invoice when available

commit c4f9601
Author: Vlad Stan <[email protected]>
Date:   Fri Sep 18 12:55:16 2026 +0300

    refactor: remove un-necessary type

commit b60f43f
Author: Vlad Stan <[email protected]>
Date:   Fri Sep 18 12:02:11 2026 +0300

    doc: clean-up

commit 6f40071
Author: Vlad Stan <[email protected]>
Date:   Thu Sep 17 19:15:28 2026 +0300

    feat: save `payment_request` for bolt12 invoices

commit 422332a
Author: Vlad Stan <[email protected]>
Date:   Thu Sep 17 15:38:13 2026 +0300

    Squashed commit of the following:

    commit af9b7ab
    Author: Vlad Stan <[email protected]>
    Date:   Thu Sep 17 15:30:40 2026 +0300

        feat: show offer memo and amount if present

    commit b237802
    Author: Vlad Stan <[email protected]>
    Date:   Thu Sep 17 15:09:22 2026 +0300

        chore: make bundle

    commit 5fe3cc8
    Author: Vlad Stan <[email protected]>
    Date:   Thu Sep 17 14:56:43 2026 +0300

        feat: show offer on ui

    commit f7c7c93
    Author: Vlad Stan <[email protected]>
    Date:   Thu Sep 17 14:47:22 2026 +0300

        test: fix tests

    commit 4f49729
    Author: Vlad Stan <[email protected]>
    Date:   Thu Sep 17 14:18:22 2026 +0300

        refactor: use `memo` for public api

    commit 2307dfe
    Author: alan <[email protected]>
    Date:   Thu Sep 17 11:08:54 2026 +0000

        chore: make bundle [skip ci]

    commit 5ef286b
    Author: Vlad Stan <[email protected]>
    Date:   Thu Sep 17 13:56:57 2026 +0300

        test: payer_note regtest

    commit 3551e85
    Author: Vlad Stan <[email protected]>
    Date:   Thu Sep 17 13:25:29 2026 +0300

        fix: optional payer_note for eclair

    commit a803991
    Author: Vlad Stan <[email protected]>
    Date:   Thu Sep 17 13:23:09 2026 +0300

        feat: payer_note first

* fix: cln amount change

* fix: prevent BOLT12 payments from being refunded after timeout

* fix: keep ambiguous CLNRest offer payments pending

* fix: wallet fees and fake wallet

commit d12c0fe
Author: Vlad Stan <[email protected]>
Date:   Mon Sep 21 16:09:10 2026 +0300

    feat: create fake bolt12 invoice

commit 393ab9d
Author: Vlad Stan <[email protected]>
Date:   Mon Sep 21 15:45:55 2026 +0300

    feat: add `lnbits_funding_source_pay_offer_wait_seconds` settings

commit 04ebf30
Author: Vlad Stan <[email protected]>
Date:   Mon Sep 21 13:34:06 2026 +0300

    fix: safer phoenixd status check

commit 88b3072
Author: Vlad Stan <[email protected]>
Date:   Mon Sep 21 13:15:36 2026 +0300

    fix: eclair fee

* chore: make bundle

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: monasco <[email protected]>
Co-authored-by: DrShift <[email protected]>
Co-authored-by: Vlad Stan <[email protected]>
Co-authored-by: Arc <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bitkarrot <[email protected]>
Co-authored-by: bitkarrot <[email protected]>
Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: UniSyncInc2212 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Deleting a user wallet the second time returns 404 instead of removing it

3 participants