Skip to content

Commit

Permalink
backend/accounts: bring back watchonly account immediately if unhidden
Browse files Browse the repository at this point in the history
In manage accounts in the edit button, one can hide and account. The
account is hidden immediately, but the dialog remains open, so the
user can unhide it. This commit changes the backend to bring back the
account immediately in this case.
  • Loading branch information
benma committed Nov 29, 2023
1 parent b54eac5 commit 52b9f63
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions backend/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ func copyBool(b *bool) *bool {
// AccountSetWatch sets the account's persisted watch flag to `watch`. Set to `true` if the account
// should be loaded even if its keystore is not connected.
// If `watch` is set to `false`, the account is unloaded and the frontend notified.
// If `watch` is set to `true`, the account is loaded (if the global watchonly flag is enabled) and the frontend notified.
func (backend *Backend) AccountSetWatch(filter func(*config.Account) bool, watch *bool) error {
err := backend.config.ModifyAccountsConfig(func(accountsConfig *config.AccountsConfig) error {
for _, acct := range accountsConfig.Accounts {
Expand Down Expand Up @@ -524,10 +525,8 @@ func (backend *Backend) AccountSetWatch(filter func(*config.Account) bool, watch
}
}

if watch == nil || !*watch {
backend.initAccounts(false)
backend.emitAccountsStatusChanged()
}
backend.initAccounts(false)
backend.emitAccountsStatusChanged()
return nil
}

Expand Down

0 comments on commit 52b9f63

Please sign in to comment.