diff --git a/blocksync/reactor_test.go b/blocksync/reactor_test.go index 7b0b762e8..66c12a60b 100644 --- a/blocksync/reactor_test.go +++ b/blocksync/reactor_test.go @@ -166,7 +166,8 @@ func TestNoBlockResponse(t *testing.T) { for _, reactor := range reactorPairs { // turn on the syncing algorithm - reactor.reactor.SwitchToBlockSync(state) + err := reactor.reactor.SwitchToBlockSync(state) + require.NoError(t, err) } defer func() { @@ -249,7 +250,8 @@ func TestBadBlockStopsPeer(t *testing.T) { for _, reactor := range reactorPairs { // turn on the syncing algorithm - reactor.reactor.SwitchToBlockSync(state) + err := reactor.reactor.SwitchToBlockSync(state) + require.NoError(t, err) } defer func() { @@ -296,7 +298,9 @@ func TestBadBlockStopsPeer(t *testing.T) { } otherState, err := sm.MakeGenesisState(otherGenDoc) - lastReactorPair.reactor.SwitchToBlockSync(otherState) + require.NoError(t, err) + err = lastReactorPair.reactor.SwitchToBlockSync(otherState) + require.NoError(t, err) for { if lastReactorPair.reactor.pool.IsCaughtUp() || lastReactorPair.reactor.Switch.Peers().Size() == 0 { diff --git a/consensus/byzantine_test.go b/consensus/byzantine_test.go index f1de1e87f..a48845692 100644 --- a/consensus/byzantine_test.go +++ b/consensus/byzantine_test.go @@ -256,7 +256,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) { // start the consensus reactors for i := 0; i < nValidators; i++ { - reactors[i].SwitchToConsensus(state.Copy(), false) + require.NoError(t, reactors[i].SwitchToConsensus(state.Copy(), false)) } defer stopConsensusNet(log.TestingLogger(), reactors, eventBuses) @@ -409,13 +409,13 @@ func TestByzantineConflictingProposalsWithPartition(t *testing.T) { // note these must be started before the byz for i := 1; i < N; i++ { cr := reactors[i].(*Reactor) - cr.SwitchToConsensus(cr.conS.GetState(), false) + require.NoError(t, cr.SwitchToConsensus(cr.conS.GetState(), false)) } // start the byzantine state machine byzR := reactors[0].(*ByzantineReactor) s := byzR.reactor.conS.GetState() - byzR.reactor.SwitchToConsensus(s, false) + require.NoError(t, byzR.reactor.SwitchToConsensus(s, false)) // byz proposer sends one block to peers[0] // and the other block to peers[1] and peers[2]. diff --git a/consensus/reactor_test.go b/consensus/reactor_test.go index c577f3fad..6980e0601 100644 --- a/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -87,7 +87,8 @@ func startConsensusNet(t *testing.T, css []*State, n int) ( // TODO: is this still true with new pubsub? for i := 0; i < n; i++ { s := reactors[i].conS.GetState() - reactors[i].SwitchToConsensus(s, false) + err := reactors[i].SwitchToConsensus(s, false) + require.NoError(t, err) } return reactors, blocksSubs, eventBuses } diff --git a/consensus/replay_test.go b/consensus/replay_test.go index 70b7edeb4..8d0cb7fde 100644 --- a/consensus/replay_test.go +++ b/consensus/replay_test.go @@ -663,12 +663,12 @@ func tempWALWithData(data []byte) string { // Then restart the app and sync it up with the remaining blocks func testHandshakeReplay(t *testing.T, nBlocks int, mode uint, testValidatorsChange bool) { var ( - chain []*types.Block - commits []*types.Commit - store *mockBlockStore - stateDB dbm.DB + chain []*types.Block + commits []*types.Commit + store *mockBlockStore + stateDB dbm.DB genesisState sm.State - config *cfg.Config + config *cfg.Config ) if testValidatorsChange { config = ResetConfig(fmt.Sprintf("%s_%v_m", t.Name(), mode)) @@ -816,7 +816,7 @@ func buildAppStateFromChain(t *testing.T, proxyApp proxy.AppConns, stateStore sm validators := types.TM2PB.ValidatorUpdates(state.Validators) _, err := proxyApp.Consensus().InitChainSync(abci.RequestInitChain{ Validators: validators, - }); + }) require.NoError(t, err) require.NoError(t, stateStore.Save(state)) switch mode { diff --git a/consensus/state.go b/consensus/state.go index 929ec575d..791913484 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -204,11 +204,11 @@ func WithMetrics(metrics *Metrics) StateOption { } func WithState(state sm.State) StateOption { - return func(cs *State) { + return func(cs *State) { if state.LastBlockHeight > 0 { cs.reconstructLastCommit(state) } - cs.updateToState(state) + cs.updateToState(state) } } diff --git a/node/node.go b/node/node.go index 644fcd638..bdc4c68ff 100644 --- a/node/node.go +++ b/node/node.go @@ -12,7 +12,6 @@ import ( "github.com/rs/cors" "github.com/tendermint/tendermint/blocksync" - bc "github.com/tendermint/tendermint/blocksync" cfg "github.com/tendermint/tendermint/config" cs "github.com/tendermint/tendermint/consensus" "github.com/tendermint/tendermint/evidence" @@ -49,7 +48,6 @@ type Node struct { privValidator types.PrivValidator // local node's validator key // network - transport *p2p.MultiplexTransport sw *p2p.Switch // p2p connections addrBook pex.AddrBook // known peers nodeInfo p2p.NodeInfo @@ -797,7 +795,7 @@ func makeNodeInfo( Network: genDoc.ChainID, Version: version.TMCoreSemVer, Channels: []byte{ - bc.BlocksyncChannel, + blocksync.BlocksyncChannel, cs.StateChannel, cs.DataChannel, cs.VoteChannel, cs.VoteSetBitsChannel, mempl.MempoolChannel, evidence.EvidenceChannel, diff --git a/node/node_test.go b/node/node_test.go index c504d7d57..dd5c7a8be 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -124,7 +124,7 @@ func TestNodeSetAppVersion(t *testing.T) { n, err := DefaultNewNode(config, log.TestingLogger()) require.NoError(t, err) require.NoError(t, n.Start()) - defer n.Stop() + defer n.Stop() //nolint:errcheck // default config uses the kvstore app var appVersion = kvstore.ProtocolVersion diff --git a/p2p/transport_test.go b/p2p/transport_test.go index 0271ffe01..442dee60d 100644 --- a/p2p/transport_test.go +++ b/p2p/transport_test.go @@ -113,7 +113,7 @@ func TestTransportMultiplexConnFilterTimeout(t *testing.T) { err = mt.Start() require.NoError(t, err) - defer mt.Stop() + defer mt.Stop() //nolint:errcheck errc := make(chan error) go func() { @@ -664,7 +664,7 @@ func testSetupMultiplexTransport(t *testing.T) *MultiplexTransport { err = mt.Start() require.NoError(t, err) t.Cleanup(func() { - mt.Stop() + mt.Stop() //nolint:errcheck }) // give the listener some time to get ready