(blks BlockFromPeers)
| 270 | return targetBlkNum |
| 271 | } |
| 272 | func (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 | |
| 290 | func (self *Syncer) isActive() bool { |
| 291 | return self.nextReqBlkNum <= self.targetBlkNum |
no test coverage detected