aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
authorYigit Sever2022-04-23 20:29:36 +0300
committerYigit Sever2022-04-23 20:29:36 +0300
commit21095d29f348d8c965df9871bbc0644de5000a53 (patch)
treec13444763ca514869192022fac8b861bd8663620 /src/config.rs
parentd76de7951d995026feaeb92c278f45e810acd3de (diff)
downloadgradecoin-21095d29f348d8c965df9871bbc0644de5000a53.tar.gz
gradecoin-21095d29f348d8c965df9871bbc0644de5000a53.tar.bz2
gradecoin-21095d29f348d8c965df9871bbc0644de5000a53.zip
Format, refactor, succinct errors
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/config.rs b/src/config.rs
index 28c63be..112fb3c 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -1,8 +1,8 @@
1//! # Configuration 1//! # Configuration
2//! 2//!
3//! This module holds the data structures for network configuration. 3//! This module holds the data structures for network configuration.
4use serde::{Deserialize, Serialize};
5use log::{error, info}; 4use log::{error, info};
5use serde::{Deserialize, Serialize};
6 6
7/// Configuration for a single network 7/// Configuration for a single network
8#[derive(Debug, Serialize, Deserialize, Clone, Default)] 8#[derive(Debug, Serialize, Deserialize, Clone, Default)]
@@ -29,7 +29,7 @@ pub struct Config {
29 29
30 /// Valid blocks should have this many transactions 30 /// Valid blocks should have this many transactions
31 pub block_transaction_count: u8, 31 pub block_transaction_count: u8,
32 32
33 /// How many zero hexadecimal characters should a correct hash start with? 33 /// How many zero hexadecimal characters should a correct hash start with?
34 pub hash_zeros: u8, 34 pub hash_zeros: u8,
35 35
@@ -58,15 +58,15 @@ impl Config {
58 error!("Cannot read config file: {}", filename); 58 error!("Cannot read config file: {}", filename);
59 error!("Error: {:?}", e); 59 error!("Error: {:?}", e);
60 return None; 60 return None;
61 }, 61 }
62 }; 62 };
63 let config : Config = match serde_yaml::from_reader(file) { 63 let config: Config = match serde_yaml::from_reader(file) {
64 Ok(c) => c, 64 Ok(c) => c,
65 Err(e) => { 65 Err(e) => {
66 error!("Cannot parse config file: {}", filename); 66 error!("Cannot parse config file: {}", filename);
67 error!("Error: {:?}", e); 67 error!("Error: {:?}", e);
68 return None; 68 return None;
69 }, 69 }
70 }; 70 };
71 // File closes automatically when it goes out of scope. 71 // File closes automatically when it goes out of scope.
72 info!("Config file read successfully: {}", filename); 72 info!("Config file read successfully: {}", filename);