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

Method blockCheckMerkleRoot

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

Source from the content-addressed store, hash-verified

270 return targetBlkNum
271}
272func (self *Syncer) blockCheckMerkleRoot(blks BlockFromPeers) *Block {
273 merkleRoot := make(map[common.Uint256]int)
274 for _, blk := range blks {
275 merkleRoot[blk.getPrevBlockMerkleRoot()] += 1
276 }
277 for merklerootvalue, cnt := range merkleRoot {
278 if cnt > int(self.server.config.C) {
279 // find the block
280 for _, blk := range blks {
281 if blk.getPrevBlockMerkleRoot() == merklerootvalue {
282 return blk
283 }
284 }
285 }
286 }
287 return nil
288}
289
290func (self *Syncer) isActive() bool {
291 return self.nextReqBlkNum <= self.targetBlkNum

Callers 1

runMethod · 0.95

Calls 1

Tested by

no test coverage detected