From 9b1680f55c999c6d5d9ab1e736c5afe049449872 Mon Sep 17 00:00:00 2001 From: Herbert Jordan Date: Fri, 6 Jun 2025 14:46:00 +0200 Subject: [PATCH] accounts: fix data race when closing manager --- accounts/manager.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/accounts/manager.go b/accounts/manager.go index ac21ecd9853f..a2218e54dd91 100644 --- a/accounts/manager.go +++ b/accounts/manager.go @@ -93,9 +93,6 @@ func NewManager(config *Config, backends ...Backend) *Manager { // Close terminates the account manager's internal notification processes. func (am *Manager) Close() error { - for _, w := range am.wallets { - w.Close() - } errc := make(chan error) am.quit <- errc return <-errc @@ -149,6 +146,10 @@ func (am *Manager) update() { am.lock.Unlock() close(event.processed) case errc := <-am.quit: + // Close all owned wallets + for _, w := range am.wallets { + w.Close() + } // Manager terminating, return errc <- nil // Signals event emitters the loop is not receiving values