startSubscription
Start subscription for an address with automatic reconnection.
Incremental by default. Previous behavior wiped the local UTXO cache and sync state on every subscription start, causing a visible zero-balance flicker at every app launch. Now the default path resumes from the last saved transactionId — full resync only happens when forceFullResync is true (Developer options) or a later round detects a reorg / unknown-txId signal from the indexer.
Flow:
Read saved
lastProcessedTransactionIdfrom SyncStateManager.Subscribe from that ID (null = new address, replay from genesis).
Process each update via UtxoManager.
Save progress after each Progress update (throttled).
On error: retry with exponential backoff.
Resumption:
First sync for an address: saved ID is null → replay all history.
Warm launch: saved ID present → resume from it, no wipe, no flicker.
Reconnection:
Network errors: retry with exponential backoff (1s, 2s, 4s, 8s, 16s, 32s max).
After max retries: emit error state and stop (caller must restart subscription).
Retryable errors: IOException, connection failures, WebSocket errors.
Non-retryable errors: CancellationException (user cancelled).
Force re-sync entry point (Developer Options). A UI-level "Force re-sync" button should cancel the currently-collecting Flow first, then re-call startSubscription(address, forceFullResync = true). That wipes local state once (not on every retry) and re-subscribes from genesis. No separate public forceFullResync(address) method — the flag on this function is the single authoritative entry point.
Return
Flow of sync states (Syncing, Synced, Error).
Parameters
Unshielded address to sync.
When true, clear sync state + UTXOs for address before subscribing, forcing a replay from genesis. Default false (incremental). Intended for explicit recovery paths (Developer Options button, user-initiated "reset wallet cache" action) — NOT for normal launches. Reorg / indexer-wipe detection is automatic and doesn't need this flag.