mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-05 23:57:04 +00:00
linting: apply errcheck part1
This commit is contained in:
committed by
Ethan Buchman
parent
d95ba866b8
commit
57ea4987f7
+7
-3
@@ -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.
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user