Skip to content
Snippets Groups Projects

gtest genesis parsing

Merged Hugo Trentesaux requested to merge hugo-dev into master
1 file
+ 0
21
Compare changes
  • Side-by-side
  • Inline
@@ -89,12 +89,6 @@ struct Smith {
certs_received: Vec<String>,
}
// Timestamp to block number
// fn to_bn(genesis_timestamp: u64, timestamp: u64) -> u32 {
// let duration_in_secs = timestamp.saturating_sub(genesis_timestamp);
// (duration_in_secs / 6) as u32
// }
// copied from duniter primitives
fn validate_idty_name(idty_name: &str) -> bool {
idty_name.len() >= 3
@@ -117,21 +111,6 @@ pub fn build_genesis(
) -> Result<GenesisConfig, String> {
// preparatory steps
// define genesis timestamp
let genesis_timestamp: u64 =
if let Ok(genesis_timestamp) = std::env::var("DUNITER_GENESIS_TIMESTAMP") {
genesis_timestamp
.parse()
.map_err(|_| "DUNITER_GENESIS_TIMESTAMP must be a number".to_owned())?
} else {
use std::time::SystemTime;
SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.expect("SystemTime before UNIX EPOCH!")
.as_secs()
};
log::info!("genesis timestamp: {}", genesis_timestamp);
// declare variables for building genesis
// -------------------------------------
// track if fatal error occured, but let processing continue
Loading