the first proposer as leader-proposer, all other proposer as 2nd-proposer before propose-timeout, only proposal from leader-proposer is accepted
(blockNum uint32, peerIdx uint32)
| 73 | // before propose-timeout, only proposal from leader-proposer is accepted |
| 74 | // |
| 75 | func (self *Server) isProposer(blockNum uint32, peerIdx uint32) bool { |
| 76 | self.metaLock.RLock() |
| 77 | defer self.metaLock.RUnlock() |
| 78 | |
| 79 | { |
| 80 | if peerIdx == self.Index && !isActive(self.getState()) { |
| 81 | return false |
| 82 | } |
| 83 | // the first active proposer |
| 84 | for _, id := range self.currentParticipantConfig.Proposers { |
| 85 | if self.isPeerAlive(id, blockNum) { |
| 86 | return peerIdx == id |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | // TODO: proposer check for non-current block |
| 92 | return false |
| 93 | } |
| 94 | |
| 95 | func (self *Server) is2ndProposer(blockNum uint32, peerIdx uint32) bool { |
| 96 | rank := self.getProposerRank(blockNum, peerIdx) |