mirror of
https://github.com/tendermint/tendermint.git
synced 2026-07-28 02:52:48 +00:00
Fixed BlockchainMessage{} Decode issue.
Fixed Warn(UnknownMessage) issues.
This commit is contained in:
@@ -145,7 +145,7 @@ func (bcR *BlockchainReactor) Receive(chId byte, src *p2p.Peer, msgBytes []byte)
|
||||
// Got a peer status.
|
||||
bcR.pool.SetPeerHeight(src.Key, msg.Height)
|
||||
default:
|
||||
log.Warn("Unknown message type %v", reflect.TypeOf(msg))
|
||||
log.Warn(Fmt("Unknown message type %v", reflect.TypeOf(msg)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ func DecodeMessage(bz []byte) (msgType byte, msg BlockchainMessage, err error) {
|
||||
msgType = bz[0]
|
||||
n := new(int64)
|
||||
r := bytes.NewReader(bz)
|
||||
msg = binary.ReadBinary(&msg, r, n, &err)
|
||||
msg = binary.ReadBinary(struct{ BlockchainMessage }{}, r, n, &err).(struct{ BlockchainMessage }).BlockchainMessage
|
||||
return
|
||||
}
|
||||
|
||||
@@ -300,6 +300,6 @@ type bcPeerStatusMessage struct {
|
||||
Height uint
|
||||
}
|
||||
|
||||
func (m bcPeerStatusMessage) String() string {
|
||||
func (m *bcPeerStatusMessage) String() string {
|
||||
return fmt.Sprintf("[bcPeerStatusMessage %v]", m.Height)
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ func (conR *ConsensusReactor) Receive(chId byte, peer *p2p.Peer, msgBytes []byte
|
||||
case *HasVoteMessage:
|
||||
ps.ApplyHasVoteMessage(msg)
|
||||
default:
|
||||
log.Warn("Unknown message type %v", reflect.TypeOf(msg))
|
||||
log.Warn(Fmt("Unknown message type %v", reflect.TypeOf(msg)))
|
||||
}
|
||||
|
||||
case DataChannel:
|
||||
@@ -165,11 +165,11 @@ func (conR *ConsensusReactor) Receive(chId byte, peer *p2p.Peer, msgBytes []byte
|
||||
ps.SetHasProposalPOLPart(msg.Height, msg.Round, msg.Part.Index)
|
||||
_, err = conR.conS.AddProposalPOLPart(msg.Height, msg.Round, msg.Part)
|
||||
} else {
|
||||
log.Warn("Unknown part type %v", msg.Type)
|
||||
log.Warn(Fmt("Unknown part type %v", msg.Type))
|
||||
}
|
||||
|
||||
default:
|
||||
log.Warn("Unknown message type %v", reflect.TypeOf(msg))
|
||||
log.Warn(Fmt("Unknown message type %v", reflect.TypeOf(msg)))
|
||||
}
|
||||
|
||||
case VoteChannel:
|
||||
@@ -213,10 +213,10 @@ func (conR *ConsensusReactor) Receive(chId byte, peer *p2p.Peer, msgBytes []byte
|
||||
}
|
||||
|
||||
default:
|
||||
log.Warn("Unknown message type %v", reflect.TypeOf(msg))
|
||||
log.Warn(Fmt("Unknown message type %v", reflect.TypeOf(msg)))
|
||||
}
|
||||
default:
|
||||
log.Warn("Unknown channel %X", chId)
|
||||
log.Warn(Fmt("Unknown channel %X", chId))
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
@@ -755,7 +755,6 @@ func (ps *PeerState) ApplyHasVoteMessage(msg *HasVoteMessage) {
|
||||
// Messages
|
||||
|
||||
const (
|
||||
msgTypeUnknown = byte(0x00)
|
||||
msgTypeNewRoundStep = byte(0x01)
|
||||
msgTypeCommitStep = byte(0x02)
|
||||
msgTypeProposal = byte(0x11)
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import (
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/tendermint/tendermint/binary"
|
||||
. "github.com/tendermint/tendermint/common"
|
||||
"github.com/tendermint/tendermint/events"
|
||||
"github.com/tendermint/tendermint/p2p"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
@@ -100,7 +101,7 @@ func (memR *MempoolReactor) Receive(chId byte, src *p2p.Peer, msgBytes []byte) {
|
||||
}
|
||||
|
||||
default:
|
||||
log.Warn("Unknown message type %v", reflect.TypeOf(msg))
|
||||
log.Warn(Fmt("Unknown message type %v", reflect.TypeOf(msg)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ func (pexR *PEXReactor) Receive(chId byte, src *Peer, msgBytes []byte) {
|
||||
pexR.book.AddAddress(addr, srcAddr)
|
||||
}
|
||||
default:
|
||||
log.Warn("Unknown message type %v", reflect.TypeOf(msg))
|
||||
log.Warn(Fmt("Unknown message type %v", reflect.TypeOf(msg)))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user