From 6f7333fd5f764e3664cb146303c447c8fdf1ced6 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Fri, 11 May 2018 20:26:24 +0400 Subject: [PATCH] fix tests --- state/txindex/indexer_service.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/state/txindex/indexer_service.go b/state/txindex/indexer_service.go index dd12bdf9d..edcb362e6 100644 --- a/state/txindex/indexer_service.go +++ b/state/txindex/indexer_service.go @@ -45,10 +45,16 @@ func (is *IndexerService) OnStart() error { var batch *Batch for { select { - case e := <-blockHeadersCh: + case e, ok := <-blockHeadersCh: + if !ok { + return + } numTxs = e.(types.EventDataNewBlockHeader).Header.NumTxs batch = NewBatch(numTxs) - case e := <-txsCh: + case e, ok := <-txsCh: + if !ok { + return + } if batch == nil { panic("Expected pubsub to send block header first, but got tx event") }