Skip to content

Commit 321cd1f

Browse files
committed
backend/accounts: do not reload current keystore's accounts
When doing a soft-reload, we do not need to unload and reload the accounts that belong to the current keystore - we can just leave them as is to speed things up. Without this, when disabling watch-only while a keystore is connected, all accounts would be unloaded and the keystore's accounts loaded again. With this, the keystore's accounts are not unloaded.
1 parent b4f2c9d commit 321cd1f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

backend/accounts.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,18 @@ func (backend *Backend) uninitAccounts(force bool) {
11041104
keep := []accounts.Interface{}
11051105
for _, account := range backend.accounts {
11061106
account := account
1107-
if !force && account.Config().Config.IsWatch() {
1107+
1108+
belongsToKeystore := false
1109+
if backend.keystore != nil {
1110+
fingerprint, err := backend.keystore.RootFingerprint()
1111+
if err != nil {
1112+
backend.log.WithError(err).Error("could not retrieve keystore fingerprint")
1113+
} else {
1114+
belongsToKeystore = account.Config().Config.SigningConfigurations.ContainsRootFingerprint(fingerprint)
1115+
}
1116+
}
1117+
1118+
if !force && (belongsToKeystore || account.Config().Config.IsWatch(backend.config.AppConfig().Backend.Watchonly)) {
11081119
// Do not uninit/remove account that is being watched.
11091120
keep = append(keep, account)
11101121
continue

frontends/web/src/routes/settings/manage-accounts.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class ManageAccounts extends Component<Props, State> {
106106
.then(() => event.target.disabled = false);
107107
}} />
108108
{ watchonly ? (<>
109-
Hide account:
109+
Hide account (TODO: move this to the edit dialog):
110110
<Toggle
111111
checked={!account.watch}
112112
className={style.toggle}

0 commit comments

Comments
 (0)