Skip to content

Commit

Permalink
fix close of closed channel issue
Browse files Browse the repository at this point in the history
  • Loading branch information
j75689 committed Apr 25, 2022
1 parent 3150755 commit dfff219
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions core/remote_state_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,8 @@ 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 {
if vm.bc.insertStopped() || (vm.bc.CurrentHeader().Number.Cmp(task.blockHeader.Number) == 1 &&
vm.bc.CurrentHeader().Number.Uint64()-task.blockHeader.Number.Uint64() > pruneHeightDiff) {
delete(vm.tasks, hash)
verifyTaskCounter.Dec(1)
verifyTaskFailedMeter.Mark(1)
Expand Down

0 comments on commit dfff219

Please sign in to comment.