Browse Source

rewrite indexer service in the attempt to fix failing test

https://github.com/tendermint/tendermint/pull/3227/#issuecomment-462316527
pull/3227/head
Anton Kaliaev 6 years ago
parent
commit
0d9107a098
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      state/txindex/indexer_service.go

+ 10
- 1
state/txindex/indexer_service.go View File

@ -46,8 +46,13 @@ func (is *IndexerService) OnStart() error {
select { select {
case msg := <-blockHeadersSub.Out(): case msg := <-blockHeadersSub.Out():
header := msg.Data().(types.EventDataNewBlockHeader).Header header := msg.Data().(types.EventDataNewBlockHeader).Header
if header.NumTxs == 0 {
continue
}
batch := NewBatch(header.NumTxs) batch := NewBatch(header.NumTxs)
for i := int64(0); i < header.NumTxs; i++ {
i := int64(0)
TXS_LOOP:
for {
select { select {
case msg2 := <-txsSub.Out(): case msg2 := <-txsSub.Out():
txResult := msg2.Data().(types.EventDataTx).TxResult txResult := msg2.Data().(types.EventDataTx).TxResult
@ -57,6 +62,10 @@ func (is *IndexerService) OnStart() error {
"index", txResult.Index, "index", txResult.Index,
"err", err) "err", err)
} }
i++
if i == header.NumTxs {
break TXS_LOOP
}
case <-txsSub.Cancelled(): case <-txsSub.Cancelled():
is.Logger.Error("Failed to index block. txsSub was cancelled. Did the Tendermint stop?", is.Logger.Error("Failed to index block. txsSub was cancelled. Did the Tendermint stop?",
"height", header.Height, "height", header.Height,


Loading…
Cancel
Save