MCPcopy Create free account
hub / github.com/DNAProject/DNA / ConsensusHandle

Function ConsensusHandle

p2pserver/message/utils/msg_handler.go:205–217  ·  view source on GitHub ↗

ConsensusHandle handles the consensus message from peer

(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})

Source from the content-addressed store, hash-verified

203
204// ConsensusHandle handles the consensus message from peer
205func ConsensusHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{}) {
206 log.Debugf("[p2p]receive consensus message:%v,%d", data.Addr, data.Id)
207
208 if actor.ConsensusPid != nil {
209 var consensus = data.Payload.(*msgTypes.Consensus)
210 if err := consensus.Cons.Verify(); err != nil {
211 log.Warn(err)
212 return
213 }
214 consensus.Cons.PeerId = data.Id
215 actor.ConsensusPid.Tell(&consensus.Cons)
216 }
217}
218
219// NotFoundHandle handles the not found message from peer
220func NotFoundHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{}) {

Callers 1

TestConsensusHandleFunction · 0.85

Calls 3

DebugfFunction · 0.92
WarnFunction · 0.92
VerifyMethod · 0.65

Tested by 1

TestConsensusHandleFunction · 0.68