Always lock waddrmgr for every timeout or explicit request.
Use waddrmgr.IsError to avoid logging errors when trying to lock an already locked wallet. Fixes #349.
This commit is contained in:
parent
4c839ae3d3
commit
515cbc69ce
1 changed files with 6 additions and 9 deletions
|
@ -693,20 +693,17 @@ out:
|
|||
break out
|
||||
|
||||
case <-w.lockRequests:
|
||||
timeout = nil
|
||||
case <-timeout:
|
||||
}
|
||||
|
||||
// Select statement fell through by an explicit lock or the
|
||||
// timer expiring. Lock the manager here.
|
||||
if timeout != nil {
|
||||
timeout = nil
|
||||
err := w.Manager.Lock()
|
||||
if err != nil {
|
||||
log.Errorf("Could not lock wallet: %v", err)
|
||||
} else {
|
||||
w.notifyLockStateChange(true)
|
||||
}
|
||||
timeout = nil
|
||||
err := w.Manager.Lock()
|
||||
if err != nil && !waddrmgr.IsError(err, waddrmgr.ErrLocked) {
|
||||
log.Errorf("Could not lock wallet: %v", err)
|
||||
} else {
|
||||
w.notifyLockStateChange(true)
|
||||
}
|
||||
}
|
||||
w.wg.Done()
|
||||
|
|
Loading…
Reference in a new issue