From 426c2e9f6470c600db28d1f2dbdd6d9e124c5c7f Mon Sep 17 00:00:00 2001 From: Vincenzo Di Somma Date: Tue, 13 Dec 2016 17:02:23 +0100 Subject: [PATCH] Minor fixes to Manager.Close (#464) --- waddrmgr/manager.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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