wallet/chainntfns: ensure safe shutdown during sync
This commit is contained in:
parent
74a7124666
commit
78ea2cdc9c
1 changed files with 10 additions and 2 deletions
|
@ -128,12 +128,20 @@ func (w *Wallet) handleChainNotifications() {
|
||||||
case *chain.RescanProgress:
|
case *chain.RescanProgress:
|
||||||
err = catchUpHashes(w, chainClient, n.Height)
|
err = catchUpHashes(w, chainClient, n.Height)
|
||||||
notificationName = "rescanprogress"
|
notificationName = "rescanprogress"
|
||||||
w.rescanNotifications <- n
|
select {
|
||||||
|
case w.rescanNotifications <- n:
|
||||||
|
case <-w.quitChan():
|
||||||
|
return
|
||||||
|
}
|
||||||
case *chain.RescanFinished:
|
case *chain.RescanFinished:
|
||||||
err = catchUpHashes(w, chainClient, n.Height)
|
err = catchUpHashes(w, chainClient, n.Height)
|
||||||
notificationName = "rescanprogress"
|
notificationName = "rescanprogress"
|
||||||
w.SetChainSynced(true)
|
w.SetChainSynced(true)
|
||||||
w.rescanNotifications <- n
|
select {
|
||||||
|
case w.rescanNotifications <- n:
|
||||||
|
case <-w.quitChan():
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// On out-of-sync blockconnected notifications, only
|
// On out-of-sync blockconnected notifications, only
|
||||||
|
|
Loading…
Add table
Reference in a new issue