Skip to content
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

Keystore event fix #2311

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Beerosagos
Copy link
Collaborator

Fixes an event transmission lag that caused an unexpected error (discovered in #2307) and renames a misleading backend method. See commit messages for details.

On keystore deregister the accounts linked to the keystore were closed
and sent statusChanged events to the frontend + a final `accounts` event
to notify the change in the accounts number. The lag between the status
and the accounts events caused the execution of calls towards endpoint
of already closed accounts, which generated unexpected errors.

This send an accounts event immediately after each account close, fixing
the lag.
`emitAccountsStatusChanged` is a misleading name, as it doesn't fire an
event connected to the account status, but about the number of available
accounts. As it is catched in the frontend by `syncAccountsList`
subscription, now it is called `emitAccountsListChanged`.
Copy link
Contributor

@benma benma left a comment

Choose a reason for hiding this comment

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

n keystore deregister the accounts linked to the keystore were closed
and sent statusChanged events to the frontend + a final accounts event
to notify the change in the accounts number. The lag between the status
and the accounts events caused the execution of calls towards endpoint
of already closed accounts, which generated unexpected errors.

I have a hard time understanding this. Which statusChanged event exactly?

@@ -931,6 +931,7 @@ func (backend *Backend) uninitAccounts() {
backend.onAccountUninit(account)
}
account.Close()
backend.emitAccountsListChanged()
Copy link
Contributor

Choose a reason for hiding this comment

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

at this stage backend.accounts has not changed at all though, so why fire an event here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, I guess I'd have to remove the single accounts from the slice after each iteration and then firing the event. Agree?

@Beerosagos
Copy link
Collaborator Author

Beerosagos commented Oct 25, 2023

I have a hard time understanding this. Which statusChanged event exactly?

This https://github.com/digitalbitbox/bitbox-wallet-app/blob/master/backend/coins/btc/account.go#L457

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.

None yet

2 participants