Skip to content

Keep stored delegations when the delegations request fails - #957

Merged
DRadmir merged 1 commit into
mainfrom
wt3/android-stake-sync-rpc-error
Aug 24, 2026
Merged

Keep stored delegations when the delegations request fails#957
DRadmir merged 1 commit into
mainfrom
wt3/android-stake-sync-rpc-error

Conversation

@DRadmir

@DRadmir DRadmir commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

On Android, a failed request for staking delegations was treated as "this wallet has no delegations", and the sync deleted every delegation it had stored.

A single network hiccup was enough to make a user's stake disappear from the app, most likely right after staking or unstaking, when the sync runs again immediately.

Now a failure is kept separate from an empty result, and nothing is deleted unless the request actually succeeded. iOS already behaved this way.

The staking service turned any failure of the delegations request into an
empty list, so the sync could not tell "the request failed" from "the user
has no delegations" and deleted every stored delegation for the wallet.

Return null on failure instead, matching PerpetualService.getPositions, and
let the sync bail out before the delete diff. The runCatching guard in
StakeRepository was dead code because the service never threw.
@DRadmir DRadmir self-assigned this Aug 24, 2026
@DRadmir
DRadmir merged commit 6e57b9a into main Aug 24, 2026
1 check passed
@DRadmir
DRadmir deleted the wt3/android-stake-sync-rpc-error branch August 24, 2026 04:08
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.

1 participant