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

Method CheckSubmitBlock

consensus/vbft/service.go:235–253  ·  view source on GitHub ↗
(blkNum uint32, stateRoot common.Uint256)

Source from the content-addressed store, hash-verified

233}
234
235func (self *Server) CheckSubmitBlock(blkNum uint32, stateRoot common.Uint256) bool {
236 cMsgs := self.msgPool.GetBlockSubmitMsgNums(blkNum)
237 var stateRootCnt uint32
238 for _, msg := range cMsgs {
239 c := msg.(*blockSubmitMsg)
240 if c != nil {
241 if c.BlockStateRoot == stateRoot {
242 stateRootCnt++
243 } else {
244 continue
245 }
246 }
247 }
248 m := self.config.N - (self.config.N-1)/3
249 if stateRootCnt < uint32(m) {
250 return false
251 }
252 return true
253}
254
255func (self *Server) NewConsensusPayload(payload *p2pmsg.ConsensusPayload) {
256 peerID := vconfig.PubkeyID(payload.Owner)

Callers 2

onConsensusMsgMethod · 0.95
actionLoopMethod · 0.95

Calls 1

GetBlockSubmitMsgNumsMethod · 0.80

Tested by

no test coverage detected