mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
linting: moar fixes
This commit is contained in:
parent
d7cb291fb2
commit
a15c7f221d
2
Makefile
2
Makefile
@ -90,7 +90,6 @@ metalinter_test: ensure_tools
|
|||||||
--enable=deadcode \
|
--enable=deadcode \
|
||||||
--enable=gas \
|
--enable=gas \
|
||||||
--enable=gosimple \
|
--enable=gosimple \
|
||||||
--enable=gotype \
|
|
||||||
--enable=ineffassign \
|
--enable=ineffassign \
|
||||||
--enable=misspell \
|
--enable=misspell \
|
||||||
--enable=safesql \
|
--enable=safesql \
|
||||||
@ -105,6 +104,7 @@ metalinter_test: ensure_tools
|
|||||||
#--enable=gocyclo \
|
#--enable=gocyclo \
|
||||||
#--enable=goimports \
|
#--enable=goimports \
|
||||||
#--enable=golint \ <== comments on anything exported
|
#--enable=golint \ <== comments on anything exported
|
||||||
|
#--enable=gotype \
|
||||||
#--enable=interfacer \
|
#--enable=interfacer \
|
||||||
#--enable=megacheck \
|
#--enable=megacheck \
|
||||||
#--enable=staticcheck \
|
#--enable=staticcheck \
|
||||||
|
@ -70,7 +70,7 @@ func TestByzantine(t *testing.T) {
|
|||||||
conR.SetLogger(logger.With("validator", i))
|
conR.SetLogger(logger.With("validator", i))
|
||||||
conR.SetEventBus(eventBus)
|
conR.SetEventBus(eventBus)
|
||||||
|
|
||||||
var conRI p2p.Reactor // nolint: gotype
|
var conRI p2p.Reactor // nolint: gotype, gosimple
|
||||||
conRI = conR
|
conRI = conR
|
||||||
|
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
@ -293,12 +293,12 @@ func (privVal *ByzantinePrivValidator) SignVote(chainID string, vote *types.Vote
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (privVal *ByzantinePrivValidator) SignProposal(chainID string, proposal *types.Proposal) (err error) {
|
func (privVal *ByzantinePrivValidator) SignProposal(chainID string, proposal *types.Proposal) (err error) {
|
||||||
proposal.Signature, err = privVal.Sign(types.SignBytes(chainID, proposal))
|
proposal.Signature, _ = privVal.Sign(types.SignBytes(chainID, proposal))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (privVal *ByzantinePrivValidator) SignHeartbeat(chainID string, heartbeat *types.Heartbeat) (err error) {
|
func (privVal *ByzantinePrivValidator) SignHeartbeat(chainID string, heartbeat *types.Heartbeat) (err error) {
|
||||||
heartbeat.Signature, err = privVal.Sign(types.SignBytes(chainID, heartbeat))
|
heartbeat.Signature, _ = privVal.Sign(types.SignBytes(chainID, heartbeat))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +99,9 @@ func (cs *ConsensusState) catchupReplay(csHeight int) error {
|
|||||||
// NOTE: This is just a sanity check. As far as we know things work fine without it,
|
// NOTE: This is just a sanity check. As far as we know things work fine without it,
|
||||||
// and Handshake could reuse ConsensusState if it weren't for this check (since we can crash after writing ENDHEIGHT).
|
// and Handshake could reuse ConsensusState if it weren't for this check (since we can crash after writing ENDHEIGHT).
|
||||||
gr, found, err := cs.wal.SearchForEndHeight(uint64(csHeight))
|
gr, found, err := cs.wal.SearchForEndHeight(uint64(csHeight))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if gr != nil {
|
if gr != nil {
|
||||||
if err := gr.Close(); err != nil {
|
if err := gr.Close(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -372,7 +372,7 @@ func (cs *ConsensusState) updateRoundStep(round int, step cstypes.RoundStepType)
|
|||||||
// enterNewRound(height, 0) at cs.StartTime.
|
// enterNewRound(height, 0) at cs.StartTime.
|
||||||
func (cs *ConsensusState) scheduleRound0(rs *cstypes.RoundState) {
|
func (cs *ConsensusState) scheduleRound0(rs *cstypes.RoundState) {
|
||||||
//cs.Logger.Info("scheduleRound0", "now", time.Now(), "startTime", cs.StartTime)
|
//cs.Logger.Info("scheduleRound0", "now", time.Now(), "startTime", cs.StartTime)
|
||||||
sleepDuration := rs.StartTime.Sub(time.Now()) // nolint: gotype
|
sleepDuration := rs.StartTime.Sub(time.Now()) // nolint: gotype, gosimple
|
||||||
cs.scheduleTimeout(sleepDuration, rs.Height, 0, cstypes.RoundStepNewHeight)
|
cs.scheduleTimeout(sleepDuration, rs.Height, 0, cstypes.RoundStepNewHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ func (n *Node) OnStop() {
|
|||||||
n.eventBus.Stop()
|
n.eventBus.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunForever waits for an interupt signal and stops the node.
|
// RunForever waits for an interrupt signal and stops the node.
|
||||||
func (n *Node) RunForever() {
|
func (n *Node) RunForever() {
|
||||||
// Sleep forever and then...
|
// Sleep forever and then...
|
||||||
cmn.TrapSignal(func() {
|
cmn.TrapSignal(func() {
|
||||||
|
@ -63,6 +63,9 @@ func Discover() (nat NAT, err error) {
|
|||||||
}
|
}
|
||||||
var n int
|
var n int
|
||||||
_, _, err = socket.ReadFromUDP(answerBytes)
|
_, _, err = socket.ReadFromUDP(answerBytes)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
for {
|
for {
|
||||||
n, _, err = socket.ReadFromUDP(answerBytes)
|
n, _, err = socket.ReadFromUDP(answerBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
// doubleSha256 calculates sha256(sha256(b)) and returns the resulting bytes.
|
// doubleSha256 calculates sha256(sha256(b)) and returns the resulting bytes.
|
||||||
func doubleSha256(b []byte) []byte {
|
func doubleSha256(b []byte) []byte {
|
||||||
hasher := sha256.New()
|
hasher := sha256.New()
|
||||||
_, _ := hasher.Write(b) // error ignored
|
_, _ = hasher.Write(b) // error ignored
|
||||||
sum := hasher.Sum(nil)
|
sum := hasher.Sum(nil)
|
||||||
hasher.Reset()
|
hasher.Reset()
|
||||||
_, _ = hasher.Write(sum) // error ignored
|
_, _ = hasher.Write(sum) // error ignored
|
||||||
|
@ -782,5 +782,5 @@ func writeListOfEndpoints(w http.ResponseWriter, r *http.Request, funcMap map[st
|
|||||||
buf.WriteString("</body></html>")
|
buf.WriteString("</body></html>")
|
||||||
w.Header().Set("Content-Type", "text/html")
|
w.Header().Set("Content-Type", "text/html")
|
||||||
w.WriteHeader(200)
|
w.WriteHeader(200)
|
||||||
_, _ := w.Write(buf.Bytes()) // error ignored
|
_, _ = w.Write(buf.Bytes()) // error ignored
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user