Skip to content

Commit

Permalink
Parse validators field in genesis api
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Nov 28, 2019
1 parent 10a3026 commit 4ea5865
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
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

0 comments on commit 4ea5865

Please sign in to comment.