Skip to content

platform-wallet: shielded funding holds shield_guard through the unbounded ChainLock wait, blocking other shield-class operations #5518

Open

Description

@romchornyi

Expected Behavior

While a shielded fund-from-asset-lock waits for its funding transaction's ChainLock, independent operations that take shield_guard (install_shielded_views, shield-from-account, abandon_shielded_identity_debit, …) can proceed. The user-facing funding flows keep their documented policy: a broadcast lock is pending, never failed, so the wait itself stays unbounded.

Current Behavior

shielded_fund_from_asset_lock takes shield_guard before funding and holds it to the end (fund_from_asset_lock.rs). Two branches wait for a ChainLock inside it with cl_wait = None from user-facing callers:

  1. the IS-lock timeout fallback (resolve_chain_proof_after_is_timeout);
  2. since fix(platform-wallet): retry an oversized InstantSend asset-lock transition with a ChainLock proof #5460, the IS→CL fallback after an InstantSend proof that makes the transition too large (dashwallet-ios#1042). On a fresh lock this waits for a block plus its ChainLock (87 s in a testnet run), and without a bound if SPV stalls.

For that whole time every other operation behind shield_guard waits.

Possible Solution

Separate the finality wait from the guarded phases in both branches: release the guard for the ChainLock wait, then re-acquire it and re-validate what the guard protects (shielded key binding, attachment, the tracked lock's state, removal) before building and submitting with the ChainLock proof. A regression test should park finality, let independent guarded work proceed, and check that a removal during the wait prevents a stale submit.

Steps to Reproduce

Not reproduced as a separate symptom; found in review of #5460. Shape: shield from Core with a balance of ~80+ small coins so the InstantSend proof is too large; while it waits for the ChainLock, start another shield-class operation on the same wallet: it waits until the first finishes.

Context

Raised by thepastaclaw on #5460 (suggestion, non-blocking). Related: #5460, dashwallet-ios#1042.

Your Environment

platform v5.1-dev with #5460.

Activity

  1. added
    bug
    on Oct 21, 2026
  2. QuantumExplorer commented on Nov 24, 2026

    @QuantumExplorer
    Member

    Note from the review of #6203, for whoever takes this: a bind is one of the operations that waits here, and it waits holding more than shield_guard's other waiters do.

    bind_shielded (and the persisted and add-account forms) takes the wallet generation's lifecycle gate, the coordinator's operation admission and shielded_config_lock, and only then, as the first step of the install, shield_guard. A re-bind that arrives while a funding waits for its ChainLock therefore parks with all three in hand. Until the funding returns:

    • a removal of the wallet waits (the gate);
    • a shielded Clear is refused with ShieldedOperationInProgress (the admission);
    • another bind, an account add, a tip address preparation and a token pool transfer or unshield of that wallet stall (the configuration lock).

    Spends admitted through admit_shielded_spend used to stall there too; #6203 stops them taking the configuration lock, so they no longer do. The rest is this issue's to fix. The regression test suggested above could park a bind behind the finality wait as well, and check that a removal and a Clear are not held by it.

  3. QuantumExplorer commented on Nov 24, 2026

    @QuantumExplorer
    Member

    Correction to my note above: #6203 stops only three payments from waiting for the configuration lock (a token purchase from the shielded pool, the payment for a private contact request, a private document create), which never took it before. The seven credit pool spends admitted through admit_shielded_spend keep the lock for their binding check, as merged in #6178, so they still stall behind a bind queued on a funding. Releasing shield_guard during the finality wait, as this issue proposes, frees them too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions