Skip to content

Commit

Permalink
fix SA5011 static check in ibc/../chain.go (cosmos#9333)
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba authored May 17, 2021
1 parent be34d52 commit 4aef38b
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions x/ibc/testing/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,14 +545,9 @@ func (chain *TestChain) CurrentTMClientHeader() *ibctmtypes.Header {
// CreateTMClientHeader creates a TM header to update the TM client. Args are passed in to allow
// caller flexibility to use params that differ from the chain.
func (chain *TestChain) CreateTMClientHeader(chainID string, blockHeight int64, trustedHeight clienttypes.Height, timestamp time.Time, tmValSet, tmTrustedVals *tmtypes.ValidatorSet, signers []tmtypes.PrivValidator) *ibctmtypes.Header {
var (
valSet *tmproto.ValidatorSet
trustedVals *tmproto.ValidatorSet
)
require.NotNil(chain.t, tmValSet)

vsetHash := tmValSet.Hash()

tmHeader := tmtypes.Header{
Version: tmprotoversion.Consensus{Block: tmversion.BlockProtocol, App: 2},
ChainID: chainID,
Expand All @@ -567,7 +562,7 @@ func (chain *TestChain) CreateTMClientHeader(chainID string, blockHeight int64,
AppHash: chain.CurrentHeader.AppHash,
LastResultsHash: tmhash.Sum([]byte("last_results_hash")),
EvidenceHash: tmhash.Sum([]byte("evidence_hash")),
ProposerAddress: tmValSet.Proposer.Address, //nolint:staticcheck
ProposerAddress: tmValSet.Proposer.Address,
}
hhash := tmHeader.Hash()
blockID := MakeBlockID(hhash, 3, tmhash.Sum([]byte("part_set")))
Expand All @@ -581,13 +576,11 @@ func (chain *TestChain) CreateTMClientHeader(chainID string, blockHeight int64,
Commit: commit.ToProto(),
}

if tmValSet != nil {
valSet, err = tmValSet.ToProto()
if err != nil {
panic(err)
}
valSet, err := tmValSet.ToProto()
if err != nil {
panic(err)
}

var trustedVals *tmproto.ValidatorSet
if tmTrustedVals != nil {
trustedVals, err = tmTrustedVals.ToProto()
if err != nil {
Expand Down

0 comments on commit 4aef38b

Please sign in to comment.