diff --git a/tendermint-rs/src/config.rs b/tendermint-rs/src/config.rs
index f9f2980..9042549 100644
--- a/tendermint-rs/src/config.rs
+++ b/tendermint-rs/src/config.rs
@@ -14,6 +14,7 @@ pub use self::{node_key::NodeKey, priv_validator_key::PrivValidatorKey};
use crate::{
abci::tag,
error::{Error, ErrorKind},
+ genesis::Genesis,
net, node, Moniker, Timeout,
};
use serde::{de, de::Error as _, ser, Deserialize, Serialize};
@@ -120,6 +121,18 @@ impl TendermintConfig {
Self::parse_toml(toml_string)
}
+
+ /// Load `genesis.json` file from the configured location
+ pub fn load_genesis_file
(&self, home: &P) -> Result
+ where
+ P: AsRef,
+ {
+ 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())?)
+ }
}
/// Database backend
diff --git a/tendermint-rs/src/lib.rs b/tendermint-rs/src/lib.rs
index 345f42a..f9ba29d 100644
--- a/tendermint-rs/src/lib.rs
+++ b/tendermint-rs/src/lib.rs
@@ -39,7 +39,7 @@ pub mod channel;
pub mod config;
pub mod consensus;
pub mod evidence;
-#[cfg(feature = "rpc")]
+#[cfg(any(feature = "config", feature = "rpc"))]
pub mod genesis;
pub mod hash;
pub mod merkle;