Minor fixes to Manager.Close (#464)

This commit is contained in:
Vincenzo Di Somma 2016-12-13 17:02:23 +01:00 committed by Josh Rickmar
parent 3a7608a747
commit 426c2e9f64

View file

@ -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