From 426ce6b84fe6cba6fd4947fb54ba5d5837c65b73 Mon Sep 17 00:00:00 2001 From: necrashter Date: Sat, 23 Apr 2022 13:15:06 +0300 Subject: Add basic config struct --- src/config.rs | 20 ++++++++++++++++++++ src/main.rs | 1 + 2 files changed, 21 insertions(+) create mode 100644 src/config.rs diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..80d2def --- /dev/null +++ b/src/config.rs @@ -0,0 +1,20 @@ +//! # Configuration +//! +//! This module holds the data structures for network configuration. +use serde::{Deserialize, Serialize}; + +/// Configuration for a single network +#[derive(Debug, Serialize, Deserialize, Clone, Default)] +pub struct Config { + // Valid blocks should have this many transactions + pub block_transaction_count: u8, + // Inital registration bonus + pub register_bonus: u16, + // Coinbase reward + pub block_reward: u16, + // Transaction amount limit + pub tx_upper_limit: u16, + pub tx_lower_limit: u16, + // Transaction traffic reward + pub tx_traffic_reward: u16, +} diff --git a/src/main.rs b/src/main.rs index f0027f2..57ee526 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,6 +29,7 @@ mod handlers; mod routes; mod block; mod student; +mod config; pub use block::{Fingerprint, Id}; use db::Db; -- cgit v1.2.3-70-g09d2