Skip to content

Shielded: shielded_add_account() updates per-wallet keys but not the coordinator registry (half-live account) #3705

Open

Description

@QuantumExplorer

What

PlatformWallet::shielded_add_account (packages/rs-platform-wallet/src/wallet/platform_wallet.rs) inserts a newly-derived OrchardKeySet into the per-wallet self.shielded_keys map, but does not register the new account's viewing keys on the NetworkShieldedCoordinator.

Why it needs fixing

After the Phase-2b refactor, NetworkShieldedCoordinator::sync() iterates coordinator.accounts to decide which IVKs to trial-decrypt. An account added via shielded_add_account is in shielded_keys but not in coordinator.accounts, producing a half-live account:

  • shielded_account_indices(), shielded_default_address(), and the spend free functions all accept it (they read shielded_keys)…
  • …but background sync never trial-decrypts or persists notes for it.

Notes addressed to that account accumulate on-chain undetected. The method returns Ok(()) while silently doing the wrong thing; the "hosts should re-call bind_shielded" workaround lives only in a comment.

Fix

Extend the signature to take &Arc<NetworkShieldedCoordinator> and register the new account atomically alongside the keyset insert (or drop the method from the public surface). This is a public-API/FFI/Swift signature change, hence its own commit.

Deferred from #3603 review (thepastaclaw).

Activity

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

    bugplatform-wallet

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions