Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

tendermint-rs: TendermintConfig::load_node_key #315

Merged
merged 1 commit into from
Jul 26, 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
1 change: 1 addition & 0 deletions tendermint-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ serde_json = "1"
default = ["serde", "tai64"]
amino-types = ["prost-amino", "prost-amino-derive"]
config = ["serde", "serde_json", "toml", "zeroize"]
keys = ["signatory-dalek"]
rpc = ["hyper", "rand_os", "serde", "serde_json", "uuid"]
secret-connection = [
"amino-types",
Expand Down
13 changes: 8 additions & 5 deletions tendermint-rs/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,19 @@ impl TendermintConfig {
}

/// Load `genesis.json` file from the configured location
pub fn load_genesis_file<P>(&self, home: &P) -> Result<Genesis, Error>
where
P: AsRef<Path>,
{
pub fn load_genesis_file(&self, home: impl AsRef<Path>) -> Result<Genesis, Error> {
let path = home.as_ref().join(&self.genesis_file);
let genesis_json = fs::read_to_string(&path)
.map_err(|e| err!(ErrorKind::Parse, "couldn't open {}: {}", path.display(), e))?;

Ok(serde_json::from_str(genesis_json.as_ref())?)
}

/// Load `node_key.json` file from the configured location
pub fn load_node_key(&self, home: impl AsRef<Path>) -> Result<NodeKey, Error> {
let path = home.as_ref().join(&self.node_key_file);
NodeKey::load_json_file(&path)
}
}

/// Database backend
Expand Down Expand Up @@ -386,7 +389,7 @@ pub struct P2PConfig {
/// UPNP port forwarding
pub upnp: bool,

/// Path to address boo
/// Path to address book
pub addr_book_file: PathBuf,

/// Set `true` for strict address routability rules
Expand Down
2 changes: 1 addition & 1 deletion tendermint-rs/src/consensus.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Tendermint consensus

mod params;
pub mod params;
mod state;

pub use self::{params::Params, state::State};