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

Method constructHandshakeMsg

consensus/vbft/msg_builder.go:140–155  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

138}
139
140func (self *Server) constructHandshakeMsg() (*peerHandshakeMsg, error) {
141
142 blkNum := self.GetCurrentBlockNo() - 1
143 block, blockhash := self.blockPool.getSealedBlock(blkNum)
144 if block == nil {
145 return nil, fmt.Errorf("failed to get sealed block, current block: %d", self.GetCurrentBlockNo())
146 }
147 msg := &peerHandshakeMsg{
148 CommittedBlockNumber: blkNum,
149 CommittedBlockHash: blockhash,
150 CommittedBlockLeader: block.getProposer(),
151 ChainConfig: self.config,
152 }
153
154 return msg, nil
155}
156
157func (self *Server) constructHeartbeatMsg() (*peerHeartbeatMsg, error) {
158

Callers

nothing calls this directly

Calls 4

GetCurrentBlockNoMethod · 0.95
getSealedBlockMethod · 0.80
ErrorfMethod · 0.80
getProposerMethod · 0.80

Tested by

no test coverage detected