Skip to content

feat: prevent Liquid send crash on >256 UTXOs via self-transfer consolidation - #2465

Merged
i5hi merged 10 commits into
developfrom
fix/liquid-wallet-utxo-limit
Jul 22, 2026
Merged

feat: prevent Liquid send crash on >256 UTXOs via self-transfer consolidation#2465
i5hi merged 10 commits into
developfrom
fix/liquid-wallet-utxo-limit

Conversation

@wired-pasteque

@wired-pasteque wired-pasteque commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

What

Fixes the crash when spending from a Liquid wallet holding more than ~256 UTXOs (the confidential-transaction input limit), and adds a guided consolidation flow so the wallet never gets there in the first place.

How it works

  1. Crash → catchable error. LwkWalletDatasource.buildPset now
    proactively/reactively detects when a wallet's confirmed L-BTC UTXO count
    exceeds the limit and throws ConsolidationRequiredException instead of
    letting the native call crash the app.
  2. Detection. CheckLiquidConsolidationUsecase reads the wallet's
    L-BTC UTXO count and compares it against a threshold set safely below
    the hard limit (250), so the user is warned well before a real spend
    would ever fail.
  3. Consolidation. A new consolidation feature lets the user sweep
    their UTXOs into a single self-transfer output (or a few, if the count
    is large enough to need batching)
  4. User-facing warning. A ConsolidationRequiredCard banner surfaces
    on the wallet home/detail screens, and inline on the send and swap
    screens, whenever a wallet crosses the threshold — routing to the new
    consolidation screen.

Also fixed along the way

  • Partial-broadcast retry gap: if consolidation fails partway through
    broadcasting several batches, the already-succeeded batches' txids are
    now tracked (ConsolidationException.succeededTxids) instead of
    discarded, and the cached preview is cleared on failure so a retry always
    rebuilds fresh PSETs rather than resubmitting an already-broadcast (and
    so already-spent) batch.
  • Re-entrancy guard: a fast double-tap on "Consolidate" can no longer
    run the build→sign→broadcast pipeline twice concurrently.
  • Silent failures now logged: both the fee-preview build and the
    broadcast step used to swallow failures with no trace; both now log the
    cause via the app's logger.

Tested using small amounts of UTXOs.

Screen.Recording.2026-07-22.at.12.38.06.AM.mov

@wired-pasteque wired-pasteque self-assigned this Jul 17, 2026
@wired-pasteque
wired-pasteque force-pushed the fix/liquid-wallet-utxo-limit branch from 75f4296 to a77c012 Compare July 22, 2026 05:12
@wired-pasteque
wired-pasteque force-pushed the fix/liquid-wallet-utxo-limit branch from a77c012 to 99395b4 Compare July 22, 2026 05:20
@wired-pasteque wired-pasteque changed the title feat: add UTXO consolidation for Liquid wallets feat: prevent Liquid send crash on >256 UTXOs via self-transfer consolidation Jul 22, 2026
@wired-pasteque
wired-pasteque requested a review from i5hi July 22, 2026 11:45
@wired-pasteque
wired-pasteque marked this pull request as ready for review July 22, 2026 11:45
@i5hi
i5hi merged commit 866fd7c into develop Jul 22, 2026
2 checks passed
@wired-pasteque wired-pasteque linked an issue Jul 22, 2026 that may be closed by this pull request
7 tasks
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.

App crashes when spending from Liquid wallet with >256 UTXOs

2 participants