Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common/client-libs/validator-client/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ pub mod mixmining;
pub mod mixnode;
mod node;
pub mod topology;
pub mod validators;
2 changes: 2 additions & 0 deletions common/client-libs/validator-client/src/models/topology.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use crate::models::gateway::RegisteredGateway;
use crate::models::mixnode::RegisteredMix;
use crate::models::validators::ValidatorsOutput;
use log::*;
use serde::{Deserialize, Serialize};
use std::convert::TryInto;
Expand All @@ -25,6 +26,7 @@ use topology::{MixLayer, NymTopology};
pub struct Topology {
pub mix_nodes: Vec<RegisteredMix>,
pub gateways: Vec<RegisteredGateway>,
pub validators: ValidatorsOutput,
}

// changed from `TryInto`. reason being is that we should not fail entire topology
Expand Down
29 changes: 29 additions & 0 deletions common/client-libs/validator-client/src/models/validators.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2020 Nym Technologies SA
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ValidatorsOutput {
pub(crate) block_height: i64,
pub(crate) validators: Vec<ValidatorOutput>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub(crate) struct ValidatorOutput {
pub(crate) address: String,
pub(crate) pub_key: String,
pub(crate) proposer_priority: i64,
pub(crate) voting_power: i64,
}