Skip to content

Commit 2fed51b

Browse files
committed
backend/accounts: skip unsupported coins when adding hidden accounts
With a BB02 BTC-only version, the log showed attempts to add LTC accounts, which were then skipped as unsupported. We can abort earlier in this case, which prevents the log from showing 'automatically created hidden account' for LTC accounts when LTC is not supported.
1 parent 0be83dd commit 2fed51b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

backend/accounts.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,6 +1496,14 @@ func (backend *Backend) maybeAddHiddenUnusedAccounts() {
14961496
coinCodes = []coinpkg.Code{coinpkg.CodeBTC, coinpkg.CodeLTC}
14971497
}
14981498
for _, coinCode := range coinCodes {
1499+
coin, err := backend.Coin(coinCode)
1500+
if err != nil {
1501+
backend.log.Errorf("could not find coin %s", coinCode)
1502+
continue
1503+
}
1504+
if !backend.keystore.SupportsCoin(coin) {
1505+
continue
1506+
}
14991507
var newAccountCode *accountsTypes.Code
15001508
err = backend.config.ModifyAccountsConfig(func(cfg *config.AccountsConfig) error {
15011509
newAccountCode = do(cfg, coinCode)
@@ -1509,11 +1517,6 @@ func (backend *Backend) maybeAddHiddenUnusedAccounts() {
15091517
continue
15101518
}
15111519
if newAccountCode != nil {
1512-
coin, err := backend.Coin(coinCode)
1513-
if err != nil {
1514-
backend.log.Errorf("could not find coin %s", coinCode)
1515-
continue
1516-
}
15171520
accountConfig := backend.config.AccountsConfig().Lookup(*newAccountCode)
15181521
if accountConfig == nil {
15191522
backend.log.Errorf("could not find newly persisted account %s", *newAccountCode)

0 commit comments

Comments
 (0)