Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse validators field in genesis api #65

Merged
merged 1 commit into from
Nov 28, 2019
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
5 changes: 4 additions & 1 deletion tendermint/src/genesis.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Genesis data

use crate::{chain, consensus, Hash, Time};
use crate::{chain, consensus, validator, Hash, Time};
use serde::{Deserialize, Serialize};

/// Genesis data
Expand All @@ -15,6 +15,9 @@ pub struct Genesis<AppState = serde_json::Value> {
/// Consensus parameters
pub consensus_params: consensus::Params,

/// Validators
pub validators: Vec<validator::Info>,

/// App hash
pub app_hash: Hash,

Expand Down
1 change: 1 addition & 0 deletions tendermint/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub struct Info {
pub pub_key: PublicKey,

/// Validator voting power
#[serde(alias = "power")]
pub voting_power: vote::Power,

/// Validator proposer priority
Expand Down
11 changes: 11 additions & 0 deletions tendermint/tests/support/rpc/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@
]
}
},
"validators": [
{
"address": "B00A6323737F321EB0B8D59C6FD497A14B60938A",
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "cOQZvh/h9ZioSeUMZB/1Vy1Xo5x2sjrVjlE/qHnYifM="
},
"power": "9328525",
"name": "Certus One"
}
],
"app_hash": "",
"app_state": {
"accounts": [
Expand Down