mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-29 12:41:44 +00:00
@ -10,7 +10,6 @@ linters:
|
|||||||
- errcheck
|
- errcheck
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- dupl
|
- dupl
|
||||||
- ineffassign
|
|
||||||
- interfacer
|
- interfacer
|
||||||
- unconvert
|
- unconvert
|
||||||
- goconst
|
- goconst
|
||||||
|
@ -670,7 +670,10 @@ func (cs *ConsensusState) handleMsg(mi msgInfo) {
|
|||||||
cs.mtx.Lock()
|
cs.mtx.Lock()
|
||||||
defer cs.mtx.Unlock()
|
defer cs.mtx.Unlock()
|
||||||
|
|
||||||
var err error
|
var (
|
||||||
|
err error
|
||||||
|
added bool
|
||||||
|
)
|
||||||
msg, peerID := mi.Msg, mi.PeerID
|
msg, peerID := mi.Msg, mi.PeerID
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case *ProposalMessage:
|
case *ProposalMessage:
|
||||||
@ -679,7 +682,7 @@ func (cs *ConsensusState) handleMsg(mi msgInfo) {
|
|||||||
err = cs.setProposal(msg.Proposal)
|
err = cs.setProposal(msg.Proposal)
|
||||||
case *BlockPartMessage:
|
case *BlockPartMessage:
|
||||||
// if the proposal is complete, we'll enterPrevote or tryFinalizeCommit
|
// if the proposal is complete, we'll enterPrevote or tryFinalizeCommit
|
||||||
added, err := cs.addProposalBlockPart(msg, peerID)
|
added, err = cs.addProposalBlockPart(msg, peerID)
|
||||||
if added {
|
if added {
|
||||||
cs.statsMsgQueue <- mi
|
cs.statsMsgQueue <- mi
|
||||||
}
|
}
|
||||||
@ -691,7 +694,7 @@ func (cs *ConsensusState) handleMsg(mi msgInfo) {
|
|||||||
case *VoteMessage:
|
case *VoteMessage:
|
||||||
// attempt to add the vote and dupeout the validator if its a duplicate signature
|
// attempt to add the vote and dupeout the validator if its a duplicate signature
|
||||||
// if the vote gives us a 2/3-any or 2/3-one, we transition
|
// if the vote gives us a 2/3-any or 2/3-one, we transition
|
||||||
added, err := cs.tryAddVote(msg.Vote, peerID)
|
added, err = cs.tryAddVote(msg.Vote, peerID)
|
||||||
if added {
|
if added {
|
||||||
cs.statsMsgQueue <- mi
|
cs.statsMsgQueue <- mi
|
||||||
}
|
}
|
||||||
@ -714,7 +717,8 @@ func (cs *ConsensusState) handleMsg(mi msgInfo) {
|
|||||||
cs.Logger.Error("Unknown msg type", reflect.TypeOf(msg))
|
cs.Logger.Error("Unknown msg type", reflect.TypeOf(msg))
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cs.Logger.Error("Error with msg", "height", cs.Height, "round", cs.Round, "type", reflect.TypeOf(msg), "peer", peerID, "err", err, "msg", msg)
|
cs.Logger.Error("Error with msg", "height", cs.Height, "round", cs.Round,
|
||||||
|
"type", reflect.TypeOf(msg), "peer", peerID, "err", err, "msg", msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ func parseKey(key []byte) (chainID string, height int64, part string, ok bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parseSignedHeaderKey(key []byte) (chainID string, height int64, ok bool) {
|
func parseSignedHeaderKey(key []byte) (chainID string, height int64, ok bool) {
|
||||||
chainID, height, part, ok := parseKey(key)
|
chainID, height, part, _ := parseKey(key)
|
||||||
if part != "sh" {
|
if part != "sh" {
|
||||||
return "", 0, false
|
return "", 0, false
|
||||||
}
|
}
|
||||||
@ -266,6 +266,6 @@ func parseSignedHeaderKey(key []byte) (chainID string, height int64, ok bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parseChainKeyPrefix(key []byte) (chainID string, height int64, ok bool) {
|
func parseChainKeyPrefix(key []byte) (chainID string, height int64, ok bool) {
|
||||||
chainID, height, _, ok = parseKey(key)
|
chainID, height, _, _ = parseKey(key)
|
||||||
return chainID, height, true
|
return chainID, height, true
|
||||||
}
|
}
|
||||||
|
@ -255,6 +255,7 @@ func TestConcurrencyInquirerVerify(t *testing.T) {
|
|||||||
cert.SetLogger(log.TestingLogger())
|
cert.SetLogger(log.TestingLogger())
|
||||||
|
|
||||||
err = source.SaveFullCommit(fcz[7])
|
err = source.SaveFullCommit(fcz[7])
|
||||||
|
require.Nil(err, "%+v", err)
|
||||||
err = source.SaveFullCommit(fcz[8])
|
err = source.SaveFullCommit(fcz[8])
|
||||||
require.Nil(err, "%+v", err)
|
require.Nil(err, "%+v", err)
|
||||||
sh := fcz[8].SignedHeader
|
sh := fcz[8].SignedHeader
|
||||||
|
@ -93,6 +93,7 @@ func _TestAppProofs(t *testing.T) {
|
|||||||
// verify a query before the tx block has no data (and valid non-exist proof)
|
// verify a query before the tx block has no data (and valid non-exist proof)
|
||||||
bs, height, proof, err := GetWithProof(prt, k, brh-1, cl, cert)
|
bs, height, proof, err := GetWithProof(prt, k, brh-1, cl, cert)
|
||||||
require.NoError(err, "%#v", err)
|
require.NoError(err, "%#v", err)
|
||||||
|
require.Equal(height, brh-1)
|
||||||
// require.NotNil(proof)
|
// require.NotNil(proof)
|
||||||
// TODO: Ensure that *some* keys will be there, ensuring that proof is nil,
|
// TODO: Ensure that *some* keys will be there, ensuring that proof is nil,
|
||||||
// (currently there's a race condition)
|
// (currently there's a race condition)
|
||||||
|
@ -223,7 +223,10 @@ func TestMConnectionMultiplePongsInTheBeginning(t *testing.T) {
|
|||||||
serverGotPing := make(chan struct{})
|
serverGotPing := make(chan struct{})
|
||||||
go func() {
|
go func() {
|
||||||
// read ping (one byte)
|
// read ping (one byte)
|
||||||
var packet, err = Packet(nil), error(nil)
|
var (
|
||||||
|
packet Packet
|
||||||
|
err error
|
||||||
|
)
|
||||||
_, err = cdc.UnmarshalBinaryLengthPrefixedReader(server, &packet, maxPingPongPacketSize)
|
_, err = cdc.UnmarshalBinaryLengthPrefixedReader(server, &packet, maxPingPongPacketSize)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
serverGotPing <- struct{}{}
|
serverGotPing <- struct{}{}
|
||||||
|
@ -71,7 +71,7 @@ import (
|
|||||||
// }
|
// }
|
||||||
// ```
|
// ```
|
||||||
func Status() (*ctypes.ResultStatus, error) {
|
func Status() (*ctypes.ResultStatus, error) {
|
||||||
var latestHeight int64 = -1
|
var latestHeight int64
|
||||||
if consensusReactor.FastSync() {
|
if consensusReactor.FastSync() {
|
||||||
latestHeight = blockStore.Height()
|
latestHeight = blockStore.Height()
|
||||||
} else {
|
} else {
|
||||||
|
@ -43,6 +43,7 @@ func TestApplyBlock(t *testing.T) {
|
|||||||
block := makeBlock(state, 1)
|
block := makeBlock(state, 1)
|
||||||
blockID := types.BlockID{block.Hash(), block.MakePartSet(testPartSize).Header()}
|
blockID := types.BlockID{block.Hash(), block.MakePartSet(testPartSize).Header()}
|
||||||
|
|
||||||
|
//nolint:ineffassign
|
||||||
state, err = blockExec.ApplyBlock(state, blockID, block)
|
state, err = blockExec.ApplyBlock(state, blockID, block)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user