MCPcopy
hub / github.com/canopy-network/canopy / GossipConsensus

Method GossipConsensus

controller/consensus.go:364–378  ·  view source on GitHub ↗

GossipConsensus() gossips a consensus message through the P2P network for a specific chainId

(message *bft.Message, senderPubToExclude []byte)

Source from the content-addressed store, hash-verified

362
363// GossipConsensus() gossips a consensus message through the P2P network for a specific chainId
364func (c *Controller) GossipConsensus(message *bft.Message, senderPubToExclude []byte) {
365 // log the start of the gossip consensus message function
366 var phase lib.Phase
367 if message.Qc == nil {
368 phase = message.Header.Phase
369 } else {
370 phase = message.Qc.Header.Phase
371 }
372 c.log.Debugf("Gossiping consensus message: P: %s %s", phase,
373 crypto.HashString([]byte(message.String())))
374 // send the consensus message to all peers excluding the sender (gossip)
375 if err := c.P2P.SendToPeers(Cons, message, lib.BytesToString(senderPubToExclude)); err != nil {
376 c.log.Errorf("unable to gossip consensus message with err: %s", err.Error())
377 }
378}
379
380// ListenForBlockRequests() listen for inbound block request messages from syncing peers, handles and answer them
381func (c *Controller) ListenForBlockRequests() {

Callers 1

ListenForConsensusMethod · 0.95

Calls 7

HashStringFunction · 0.92
BytesToStringFunction · 0.92
SendToPeersMethod · 0.80
DebugfMethod · 0.65
StringMethod · 0.65
ErrorfMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected