Skip to content

Fix syncing races between periodic and change-server syncing #670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

samholmes
Copy link
Contributor

@samholmes samholmes commented Jul 9, 2025

This fixes the race between periodic syncing and change-server subscriptions by introducing a usesChangeServer flag on EdgeCurrencyInfo which tells the core to not invoke periodic syncing.

In addition, we introduce a resubscribing state to the subscription status to differentiate initial subscription with intermittent subscription issues from the change server.

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

This fixes the race between periodic syncing and change-server
subscriptions by introducing a `usesChangeServer` flag on
`EdgeCurrencyInfo` which tells the core to not invoke periodic syncing.

In addition, we introduce a `resubscribing` state to the subscription
status to differentiate initial `subscription` with intermittent
subscription issues from the change server.
cursor[bot]

This comment was marked as outdated.

@samholmes
Copy link
Contributor Author

Bug: Subscription Status Overwrite Bug

The subscription status update logic incorrectly applies the same status to all subscriptions in a wallet, instead of updating each individual subscription based on its specific result. The status determined for a single subscription's outcome is then mapped to all subscriptions for that wallet, overwriting existing correct statuses (e.g., 'listening') with potentially incorrect ones (e.g., 'resubscribing'). If a wallet has multiple subscriptions with varied outcomes, the status from the last processed result will be applied to all.

src/core/currency/currency-pixie.ts#L302-L310

// Update the status for the subscription:
const subscriptions = wallet.changeServiceSubscriptions.map(
subscription => ({
...subscription,
status
})
)
subscriptionUpdates.set(walletId, subscriptions)

Fix in CursorFix in Web

Was this report helpful? Give feedback by reacting with 👍 or 👎

This is indeed true, however this is because most wallets will have a single subscription

@samholmes samholmes closed this Jul 9, 2025
@samholmes samholmes reopened this Jul 9, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Wallet Status Overwritten by Last Subscription

The subscription status update logic incorrectly applies a single determined status to all subscriptions within a wallet, rather than updating each individually. This bug was introduced by removing a filter that previously limited updates to 'subscribing' statuses. Now, the status derived from a single subscription's outcome is mapped to all subscriptions in the wallet, overwriting correct statuses (e.g., 'listening') with potentially incorrect ones (e.g., 'avoiding', 'resubscribing'). If a wallet has multiple subscriptions, the final status for all is determined by the last processed subscription's result.

src/core/currency/currency-pixie.ts#L302-L311

// Update the status for the subscription:
const subscriptions = wallet.changeServiceSubscriptions.map(
subscription => ({
...subscription,
status
})
)
subscriptionUpdates.set(walletId, subscriptions)
}

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

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.

2 participants