linting: apply errcheck part1

This commit is contained in:
Zach Ramsay
2017-11-27 22:39:11 +00:00
committed by Ethan Buchman
parent d95ba866b8
commit 57ea4987f7
25 changed files with 272 additions and 81 deletions
+7 -3
View File
@@ -270,14 +270,18 @@ func (s *State) indexTxs(abciResponses *ABCIResponses) {
batch := txindex.NewBatch(len(abciResponses.DeliverTx))
for i, d := range abciResponses.DeliverTx {
tx := abciResponses.txs[i]
batch.Add(types.TxResult{
if err := batch.Add(types.TxResult{
Height: uint64(abciResponses.Height),
Index: uint32(i),
Tx: tx,
Result: *d,
})
}); err != nil {
panic(err)
}
}
if err := s.TxIndexer.AddBatch(batch); err != nil {
panic(err)
}
s.TxIndexer.AddBatch(batch)
}
// ExecCommitBlock executes and commits a block on the proxyApp without validating or mutating the state.
+11 -3
View File
@@ -21,7 +21,9 @@ func TestTxIndex(t *testing.T) {
hash := tx.Hash()
batch := txindex.NewBatch(1)
batch.Add(*txResult)
if err := batch.Add(*txResult); err != nil {
t.Error(err)
}
err := indexer.AddBatch(batch)
require.Nil(t, err)
@@ -38,14 +40,20 @@ func benchmarkTxIndex(txsCount int, b *testing.B) {
if err != nil {
b.Fatal(err)
}
defer os.RemoveAll(dir)
defer func() {
if err := os.RemoveAll(dir); err != nil {
b.Fatal(err)
}
}()
store := db.NewDB("tx_index", "leveldb", dir)
indexer := &TxIndex{store: store}
batch := txindex.NewBatch(txsCount)
for i := 0; i < txsCount; i++ {
batch.Add(*txResult)
if err := batch.Add(*txResult); err != nil {
b.Fatal(err)
}
txResult.Index += 1
}