aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.rs2
-rw-r--r--src/db.rs18
2 files changed, 11 insertions, 9 deletions
diff --git a/src/config.rs b/src/config.rs
index 0584c31..297e587 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -6,7 +6,6 @@ use log::{error, info};
6use serde::{Deserialize, Serialize}; 6use serde::{Deserialize, Serialize};
7use std::collections::HashMap; 7use std::collections::HashMap;
8 8
9
10/// Configuration struct for a single bot 9/// Configuration struct for a single bot
11#[derive(Debug, Serialize, Deserialize, Clone, Default)] 10#[derive(Debug, Serialize, Deserialize, Clone, Default)]
12pub struct BotConfig { 11pub struct BotConfig {
@@ -14,7 +13,6 @@ pub struct BotConfig {
14 pub starting_balance: u16, 13 pub starting_balance: u16,
15} 14}
16 15
17
18/// Configuration for a single network 16/// Configuration for a single network
19#[derive(Debug, Serialize, Deserialize, Clone, Default)] 17#[derive(Debug, Serialize, Deserialize, Clone, Default)]
20pub struct Config { 18pub struct Config {
diff --git a/src/db.rs b/src/db.rs
index 6befa2d..bfa4156 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -142,15 +142,19 @@ fn read_users(config_name: &str) -> io::Result<Vec<PathBuf>> {
142fn get_bots(bot_configs: &HashMap<Fingerprint, BotConfig>) -> HashMap<Fingerprint, User> { 142fn get_bots(bot_configs: &HashMap<Fingerprint, BotConfig>) -> HashMap<Fingerprint, User> {
143 let mut index = 0; 143 let mut index = 0;
144 144
145 bot_configs.iter() 145 bot_configs
146 .iter()
146 .map(|(fingerprint, config)| { 147 .map(|(fingerprint, config)| {
147 index += 1; 148 index += 1;
148 (fingerprint.to_string(), User { 149 (
149 user_id: MetuId::new(format!("friend_{}", index), "not_used".to_owned()), 150 fingerprint.to_string(),
150 public_key: "not_used".to_owned(), 151 User {
151 balance: config.starting_balance, 152 user_id: MetuId::new(format!("friend_{}", index), "not_used".to_owned()),
152 is_bot: true, 153 public_key: "not_used".to_owned(),
153 }) 154 balance: config.starting_balance,
155 is_bot: true,
156 },
157 )
154 }) 158 })
155 .collect() 159 .collect()
156} 160}