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

Method blockConsensusDone

consensus/vbft/node_sync.go:244–261  ·  view source on GitHub ↗
(blks BlockFromPeers)

Source from the content-addressed store, hash-verified

242}
243
244func (self *Syncer) blockConsensusDone(blks BlockFromPeers) *Block {
245 // TODO: also check blockhash
246 proposers := make(map[uint32]int)
247 for _, blk := range blks {
248 proposers[blk.getProposer()] += 1
249 }
250 for proposerId, cnt := range proposers {
251 if cnt > int(self.server.config.C) {
252 // find the block
253 for _, blk := range blks {
254 if blk.getProposer() == proposerId {
255 return blk
256 }
257 }
258 }
259 }
260 return nil
261}
262
263func (self *Syncer) getCurrentTargetBlockNum() uint32 {
264 var targetBlkNum uint32

Callers 1

runMethod · 0.95

Calls 1

getProposerMethod · 0.80

Tested by

no test coverage detected