Skip to content

Commit

Permalink
fix gracefull shutdown issue
Browse files Browse the repository at this point in the history
  • Loading branch information
j75689 committed Apr 22, 2022
1 parent a73aad6 commit 734d17f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/remote_state_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ func (vm *remoteVerifyManager) mainLoop() {
case <-pruneTicker.C:
vm.taskLock.Lock()
for hash, task := range vm.tasks {
if vm.bc.insertStopped() {
close(task.terminalCh)
continue
}
if vm.bc.CurrentHeader().Number.Cmp(task.blockHeader.Number) == 1 &&
vm.bc.CurrentHeader().Number.Uint64()-task.blockHeader.Number.Uint64() > pruneHeightDiff {
delete(vm.tasks, hash)
Expand All @@ -136,7 +140,6 @@ func (vm *remoteVerifyManager) mainLoop() {
vt.messageCh <- message
}
vm.taskLock.RUnlock()

// System stopped
case <-vm.bc.quit:
vm.taskLock.RLock()
Expand Down

0 comments on commit 734d17f

Please sign in to comment.