Skip to content

Commit 3f2835e

Browse files
committed
accounts: properly close managed wallets when closing manager (ethereum#28710)
1 parent b450763 commit 3f2835e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

accounts/manager.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ func NewManager(config *Config, backends ...Backend) *Manager {
9898

9999
// Close terminates the account manager's internal notification processes.
100100
func (am *Manager) Close() error {
101+
for _, w := range am.wallets {
102+
w.Close()
103+
}
101104
errc := make(chan error)
102105
am.quit <- errc
103106
return <-errc

accounts/usbwallet/wallet.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,10 @@ func (w *wallet) Derive(path accounts.DerivationPath, pin bool) (accounts.Accoun
483483
w.stateLock.Lock()
484484
defer w.stateLock.Unlock()
485485

486+
if w.device == nil {
487+
return accounts.Account{}, accounts.ErrWalletClosed
488+
}
489+
486490
if _, ok := w.paths[address]; !ok {
487491
w.accounts = append(w.accounts, account)
488492
w.paths[address] = make(accounts.DerivationPath, len(path))

0 commit comments

Comments
 (0)