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,22 +693,19 @@ out:
|
||||||
break out
|
break out
|
||||||
|
|
||||||
case <-w.lockRequests:
|
case <-w.lockRequests:
|
||||||
timeout = nil
|
|
||||||
case <-timeout:
|
case <-timeout:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select statement fell through by an explicit lock or the
|
// Select statement fell through by an explicit lock or the
|
||||||
// timer expiring. Lock the manager here.
|
// timer expiring. Lock the manager here.
|
||||||
if timeout != nil {
|
|
||||||
timeout = nil
|
timeout = nil
|
||||||
err := w.Manager.Lock()
|
err := w.Manager.Lock()
|
||||||
if err != nil {
|
if err != nil && !waddrmgr.IsError(err, waddrmgr.ErrLocked) {
|
||||||
log.Errorf("Could not lock wallet: %v", err)
|
log.Errorf("Could not lock wallet: %v", err)
|
||||||
} else {
|
} else {
|
||||||
w.notifyLockStateChange(true)
|
w.notifyLockStateChange(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
w.wg.Done()
|
w.wg.Done()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue