validator-api: add detailed mixnode bond endpoints (#1294)
* validator-api: add mixnodes-detailed endpoint * validator-api: add detailed variants of active and rewarded set * explorer-api: cache as mixnode bond detailed * explorer-api: add in stake-saturation in response * changelog: update * rustfmt * validator-api: rename to MixNodeBondResponse * validator-api: cache MixNodeBondResponse instead * validator-api: rename to MixNodeBondAnnotated * validator-client: fix unused warning * explorer-api: remove unnecessary clone * rustfmt
This commit is contained in:
@@ -147,7 +147,7 @@ pub(crate) async fn get_mixnode_reward_estimation(
|
||||
let node_reward_params = NodeRewardParams::new(0, uptime.u8() as u128, status.is_active());
|
||||
let reward_params = RewardParams::new(reward_params, node_reward_params);
|
||||
|
||||
match bond.estimate_reward(&reward_params) {
|
||||
match bond.mixnode_bond.estimate_reward(&reward_params) {
|
||||
Ok(reward_estimate) => {
|
||||
let reponse = RewardEstimationResponse {
|
||||
estimated_total_node_reward: reward_estimate.total_node_reward,
|
||||
@@ -181,11 +181,13 @@ pub(crate) async fn get_mixnode_stake_saturation(
|
||||
) -> Result<Json<StakeSaturationResponse>, ErrorResponse> {
|
||||
let (bond, _) = cache.mixnode_details(&identity).await;
|
||||
if let Some(bond) = bond {
|
||||
// Recompute the stake saturation just so that we can confidentaly state that the `as_at`
|
||||
// field is consistent and correct. Luckily this is very cheap.
|
||||
let interval_reward_params = cache.epoch_reward_params().await;
|
||||
let as_at = interval_reward_params.timestamp();
|
||||
let interval_reward_params = interval_reward_params.into_inner();
|
||||
|
||||
let saturation = bond.stake_saturation(
|
||||
let saturation = bond.mixnode_bond.stake_saturation(
|
||||
interval_reward_params.circulating_supply(),
|
||||
interval_reward_params.rewarded_set_size() as u32,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user