ConsensusHandle handles the consensus message from peer
(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})
| 203 | |
| 204 | // ConsensusHandle handles the consensus message from peer |
| 205 | func 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 |
| 220 | func NotFoundHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{}) { |