src/main/java/toy/blockchain/Blockchain.java
/**
     * Check if <i>leader</i> is one of the last f+1 proposers.
     * @param leader the leader to be validated
     * @param f an upper bound on the faulty nodes number
     * @return true if the leader did not proposed one of the last f+1 blocks, false either
     */
Check if leader is one of the last f+1 proposers.
@param leader the leader to be validated
@param f an upper bound on the faulty nodes number
@return true if the leader did not proposed one of the last f+1 blocks, false either
Check if leader is one of the last f + 1 proposers . @param leader the leader to be validated @param f an upper bound on the faulty nodes number @return true if the leader did not proposed one of the last f + 1 blocks false either
public boolean validateCurrentLeader(int leader, int f) {
        if (blocks.size() >= (f+1) && blocks.subList(blocks.size() - (f+1), blocks.size()).
                stream().
                map(bl -> bl.getHeader().getM().getSender()).
                collect(Collectors.toList()).
                contains(leader)) {
            logger.debug(format("[#%d] leader is in the last f proposers", creatorID));
            return false;
        }
        return true;
    }
public boolean validateCurrentLeader ( int leader , int f ) { if ( blocks . size ( ) >= ( f + 1 ) && blocks . subList ( blocks . size ( ) - ( f + 1 ) , blocks . size ( ) ) . stream ( ) . map ( bl -> bl . getHeader ( ) . getM ( ) . getSender ( ) ) . collect ( Collectors . toList ( ) ) . contains ( leader ) ) { logger . debug ( format ( "[#%d] leader is in the last f proposers" , creatorID ) ) ; return false ; } return true ; }
Check if <i>leader</i> is one of the last f+1 proposers.
Check if <i > leader< / i > is one of the last f + 1 proposers .