Updated validator topology (#420)
This commit is contained in:
committed by
GitHub
parent
7c04a10545
commit
a91b2dcafc
@@ -17,3 +17,4 @@ pub mod mixmining;
|
||||
pub mod mixnode;
|
||||
mod node;
|
||||
pub mod topology;
|
||||
pub mod validators;
|
||||
|
||||
@@ -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;
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
Reference in New Issue
Block a user