Skip to content

Commit f962091

Browse files
committed
Merge branch 'plus'
2 parents 81a30e9 + 11d0099 commit f962091

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

backend/accounts.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -750,12 +750,16 @@ func (backend *Backend) addAccount(account accounts.Interface) {
750750
})
751751
if event.Subject == string(accountsTypes.EventSyncDone) {
752752
backend.notifyNewTxs(account)
753+
go backend.checkAccountUsed(account)
753754
}
754755
})
756+
if err := account.Initialize(); err != nil {
757+
backend.log.WithError(err).Error("error initializing account")
758+
return
759+
}
755760
if backend.onAccountInit != nil {
756761
backend.onAccountInit(account)
757762
}
758-
go backend.checkAccountUsed(account)
759763
}
760764

761765
// The accountsAndKeystoreLock must be held when calling this function.
@@ -1529,10 +1533,6 @@ func (backend *Backend) checkAccountUsed(account accounts.Interface) {
15291533
}
15301534
}
15311535
log := backend.log.WithField("accountCode", account.Config().Config.Code)
1532-
if err := account.Initialize(); err != nil {
1533-
log.WithError(err).Error("error initializing account")
1534-
return
1535-
}
15361536
txs, err := account.Transactions()
15371537
if err != nil {
15381538
log.WithError(err).Error("discoverAccount")

backend/backend.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"net/url"
2323
"os"
2424
"path/filepath"
25+
"slices"
2526
"strings"
2627
"time"
2728

@@ -590,7 +591,7 @@ func (backend *Backend) Testing() bool {
590591
// Accounts returns the current accounts of the backend.
591592
func (backend *Backend) Accounts() AccountsList {
592593
defer backend.accountsAndKeystoreLock.RLock()()
593-
return backend.accounts
594+
return slices.Clone(backend.accounts)
594595
}
595596

596597
// KeystoreTotalAmount represents the total balance amount of the accounts belonging to a keystore.
Binary file not shown.

0 commit comments

Comments
 (0)