waddrmgr: Avoid unnecessarily rederiving keys on unlock.

The slice of keys which must have their private extended keys derived
on unlock was never being removed from and all of these keys were
being rederived unnecessarily on every unlock.  Fix this by re-slicing
the deriveOnUnlock slice to remove the just derived key if the
derivation was successful.
This commit is contained in:
Josh Rickmar 2015-01-31 18:10:49 -05:00
parent 175875c9bd
commit 79b1839883

View file

@ -1226,6 +1226,10 @@ func (m *Manager) Unlock(passphrase []byte) error {
}
info.managedAddr.privKeyEncrypted = privKeyEncrypted
info.managedAddr.privKeyCT = privKeyBytes
// Avoid re-deriving this key on subsequent unlocks.
m.deriveOnUnlock[0] = nil
m.deriveOnUnlock = m.deriveOnUnlock[1:]
}
m.locked = false