def GetStats(self, request: qrl_pb2.GetStatsReq, context) -> qrl_pb2.GetStatsResp: response = qrl_pb2.GetStatsResp() response.node_info.CopyFrom(self.qrlnode.getNodeInfo()) response.epoch = self.qrlnode.epoch response.uptime_network = self.qrlnode.uptime_network response.stakers_count = self.qrlnode.stakers_count response.block_last_reward = self.qrlnode.block_last_reward response.block_time_mean = self.qrlnode.block_time_mean response.block_time_sd = self.qrlnode.block_time_sd response.coins_total_supply = self.qrlnode.coin_supply_max response.coins_emitted = self.qrlnode.coin_supply response.coins_atstake = self.qrlnode.coin_atstake return response
def GetStats(self, request: qrl_pb2.GetStatsReq, context) -> qrl_pb2.GetStatsResp: response = qrl_pb2.GetStatsResp() response.node_info.CopyFrom(self.qrlnode.getNodeInfo()) response.epoch = self.qrlnode.epoch response.uptime_network = self.qrlnode.uptime_network response.block_last_reward = self.qrlnode.block_last_reward response.block_time_mean = self.qrlnode.block_time_mean response.block_time_sd = self.qrlnode.block_time_sd response.coins_total_supply = int(self.qrlnode.coin_supply_max) response.coins_emitted = int(self.qrlnode.coin_supply) if request.include_timeseries: tmp = self.qrlnode.get_block_timeseries( config.dev.block_timeseries_size) response.block_timeseries.extend(tmp) return response
def GetStats(self, request: qrl_pb2.GetStatsReq, context) -> qrl_pb2.GetStatsResp: response = qrl_pb2.GetStatsResp() response.node_info.CopyFrom(self.qrlnode.get_node_info()) response.epoch = self.qrlnode.epoch response.uptime_network = self.qrlnode.uptime_network response.block_last_reward = self.qrlnode.block_last_reward response.coins_total_supply = int(self.qrlnode.coin_supply_max) response.coins_emitted = int(self.qrlnode.coin_supply) response.block_time_mean = 0 response.block_time_sd = 0 if request.include_timeseries: tmp = list(self.qrlnode.get_block_timeseries(config.dev.block_timeseries_size)) response.block_timeseries.extend(tmp) if len(tmp) > 2: vals = [v.time_last for v in tmp[1:]] response.block_time_mean = int(mean(vals)) response.block_time_sd = int(variance(vals) ** 0.5) return response