diff --git a/waddrmgr/manager.go b/waddrmgr/manager.go index 270549f..7795438 100644 --- a/waddrmgr/manager.go +++ b/waddrmgr/manager.go @@ -361,10 +361,14 @@ func (m *Manager) zeroSensitivePublicData() { // Close cleanly shuts down the manager. It makes a best try effort to remove // and zero all private key and sensitive public key material associated with // the address manager from memory. -func (m *Manager) Close() error { +func (m *Manager) Close() { m.mtx.Lock() defer m.mtx.Unlock() + if m.closed { + return + } + // Attempt to clear private key material from memory. if !m.watchingOnly && !m.locked { m.lock() @@ -374,7 +378,7 @@ func (m *Manager) Close() error { m.zeroSensitivePublicData() m.closed = true - return nil + return } // keyToManaged returns a new managed address for the provided derived key and