chain: prevent panic if onBlockConnected is called before onFilteredBlockConnected
This commit is contained in:
parent
b386e6385e
commit
e0f82255c7
1 changed files with 6 additions and 6 deletions
|
@ -605,19 +605,19 @@ func (s *NeutrinoClient) dispatchRescanFinished() {
|
||||||
}
|
}
|
||||||
|
|
||||||
s.clientMtx.Lock()
|
s.clientMtx.Lock()
|
||||||
if bs.Hash != s.lastFilteredBlockHeader.BlockHash() {
|
|
||||||
s.clientMtx.Unlock()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only send the RescanFinished notification once.
|
// Only send the RescanFinished notification once.
|
||||||
if s.finished {
|
if s.lastFilteredBlockHeader == nil || s.finished {
|
||||||
s.clientMtx.Unlock()
|
s.clientMtx.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only send the RescanFinished notification once the underlying chain
|
// Only send the RescanFinished notification once the underlying chain
|
||||||
// service sees itself as current.
|
// service sees itself as current.
|
||||||
|
if bs.Hash != s.lastFilteredBlockHeader.BlockHash() {
|
||||||
|
s.clientMtx.Unlock()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
s.finished = s.CS.IsCurrent() && s.lastProgressSent
|
s.finished = s.CS.IsCurrent() && s.lastProgressSent
|
||||||
if !s.finished {
|
if !s.finished {
|
||||||
s.clientMtx.Unlock()
|
s.clientMtx.Unlock()
|
||||||
|
|
Loading…
Reference in a new issue