| 128 | } |
| 129 | |
| 130 | func (self *Server) isCommitter(blockNum uint32, peerIdx uint32) bool { |
| 131 | self.metaLock.RLock() |
| 132 | defer self.metaLock.RUnlock() |
| 133 | |
| 134 | // the first 2C+1 active committers |
| 135 | var activeN uint32 |
| 136 | { |
| 137 | for _, id := range self.currentParticipantConfig.Committers { |
| 138 | if id == peerIdx { |
| 139 | return true |
| 140 | } |
| 141 | if self.isPeerActive(id, blockNum) { |
| 142 | activeN++ |
| 143 | if activeN > self.config.C*2 { |
| 144 | break |
| 145 | } |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | return false |
| 151 | } |
| 152 | |
| 153 | func (self *Server) getProposerRankLocked(blockNum uint32, peerIdx uint32) int { |
| 154 | if blockNum == self.currentParticipantConfig.BlockNum { |