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

Method start

consensus/vbft/service.go:519–545  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

517}
518
519func (self *Server) start() error {
520 // check if server pubkey support VRF
521 if !vrf.ValidatePrivateKey(self.account.PrivateKey) || !vrf.ValidatePublicKey(self.account.PublicKey) {
522 return fmt.Errorf("server %d consensus start failed: invalid account key for VRF", self.Index)
523 }
524
525 // start heartbeat ticker
526 self.timer.startPeerTicker(math.MaxUint32)
527
528 // start peers msg handlers
529 for _, p := range self.config.Peers {
530 peerIdx := p.Index
531 pk := self.peerPool.GetPeerPubKey(peerIdx)
532 if _, present := self.msgRecvC[peerIdx]; !present {
533 self.msgRecvC[peerIdx] = make(chan *p2pMsgPayload, 1024)
534 }
535
536 go func() {
537 if err := self.run(pk); err != nil {
538 log.Errorf("server %d, processor on peer %d failed: %s",
539 self.Index, peerIdx, err)
540 }
541 }()
542 }
543
544 return nil
545}
546
547func (self *Server) stop() {
548

Callers 1

StartMethod · 0.95

Calls 5

runMethod · 0.95
ErrorfFunction · 0.92
ErrorfMethod · 0.80
startPeerTickerMethod · 0.80
GetPeerPubKeyMethod · 0.80

Tested by

no test coverage detected