Skip to content

Commit

Permalink
linter
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsitrin committed May 15, 2024
1 parent 5ab2f15 commit 74bfba0
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions block/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ func TestProducePendingBlock(t *testing.T) {
require.NoError(t, err)
// Validate state is updated with the block that was saved in the store

//TODO: fix this test
//hacky way to validate the block was indeed contain txs
// TODO: fix this test
// hacky way to validate the block was indeed contain txs
assert.NotEqual(t, manager.State.LastResultsHash, testutil.GetEmptyLastResultsHash())
}

Expand Down
4 changes: 2 additions & 2 deletions block/produce.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (m *Manager) produceBlock(allowEmpty bool) (*types.Block, *types.Commit, er
newHeight := m.State.NextHeight()
lastHeaderHash, lastCommit, err := loadPrevBlock(m.Store, newHeight-1)
if err != nil {
if !m.State.IsGenesis() { //allow prevBlock not to be found only on genesis
if !m.State.IsGenesis() { // allow prevBlock not to be found only on genesis
return nil, nil, fmt.Errorf("load prev block: %w: %w", err, ErrNonRecoverable)
}
lastHeaderHash = [32]byte{}
Expand Down Expand Up @@ -186,7 +186,7 @@ func (m *Manager) createTMSignature(block *types.Block, proposerAddress []byte,
}
v := vote.ToProto()
// convert libp2p key to tm key
//TODO: move to types
// TODO: move to types
raw_key, _ := m.ProposerKey.Raw()
tmprivkey := tmed25519.PrivKey(raw_key)
tmprivkey.PubKey().Bytes()
Expand Down
2 changes: 1 addition & 1 deletion block/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (e *Executor) UpdateStateAfterCommit(s *types.State, resp *tmstate.ABCIResp
copy(s.AppHash[:], appHash[:])
copy(s.LastResultsHash[:], tmtypes.NewResults(resp.DeliverTxs).Hash())

//TODO: load consensus params from endblock?
// TODO: load consensus params from endblock?

s.Validators = s.NextValidators.Copy()
s.NextValidators = valSet.Copy()
Expand Down
2 changes: 1 addition & 1 deletion indexers/txindex/indexer_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (is *IndexerService) OnStart() error {
go func() {
for {
msg := <-blockHeadersSub.Out()
eventDataHeader := msg.Data().(types.EventDataNewBlockHeader)
eventDataHeader, _ := msg.Data().(types.EventDataNewBlockHeader)
height := eventDataHeader.Header.Height
batch := NewBatch(eventDataHeader.NumTxs)

Expand Down
2 changes: 1 addition & 1 deletion mempool/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (c *LRUTxCache) Push(tx types.Tx) bool {
if c.list.Len() >= c.size {
front := c.list.Front()
if front != nil {
frontKey := front.Value.(types.TxKey)
frontKey, _ := front.Value.(types.TxKey)
delete(c.cacheMap, frontKey)
c.list.Remove(front)
}
Expand Down
2 changes: 1 addition & 1 deletion mempool/v1/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (txmp *TxMempool) CheckTx(tx types.Tx, cb func(*abci.Response), txInfo memp
if !txmp.cache.Push(tx) {
// If the cached transaction is also in the pool, record its sender.
if elt, ok := txmp.txByKey[txKey]; ok {
w := elt.Value.(*WrappedTx)
w, _ := elt.Value.(*WrappedTx)
w.SetPeer(txInfo.SenderID)
}
return 0, mempool.ErrTxInCache
Expand Down
2 changes: 1 addition & 1 deletion rpc/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func (c *Client) BlockchainInfo(ctx context.Context, minHeight, maxHeight int64)
const limit int64 = 20

minHeight, maxHeight, err := filterMinMax(
0, //FIXME: we might be pruned
0, // FIXME: we might be pruned
int64(c.node.GetBlockManagerHeight()),
minHeight,
maxHeight,
Expand Down
3 changes: 1 addition & 2 deletions store/pruning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func TestStorePruning(t *testing.T) {
to uint64
shouldError bool
}{

{"blocks with pruning", []*types.Block{
testutil.GetRandomBlock(1, 0),
testutil.GetRandomBlock(2, 0),
Expand Down Expand Up @@ -79,7 +78,7 @@ func TestStorePruning(t *testing.T) {

// Validate only blocks in the range are pruned
for k := range savedHeights {
if k >= c.from && k < c.to { //k < c.to is the exclusion test
if k >= c.from && k < c.to { // k < c.to is the exclusion test
_, err := bstore.LoadBlock(k)
assert.Error(err, "Block at height %d should be pruned", k)

Expand Down
2 changes: 1 addition & 1 deletion types/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func NewStateFromGenesis(genDoc *types.GenesisDoc) (*State, error) {
// but leaves the Consensus.App version blank.
// The Consensus.App version will be set during the Handshake, once
// we hear from the app what protocol version it is running.
var InitStateVersion = tmstate.Version{
InitStateVersion := tmstate.Version{
Consensus: tmversion.Consensus{
Block: version.BlockProtocol,
App: 0,
Expand Down

0 comments on commit 74bfba0

Please sign in to comment.