Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renames config file to sim file #130

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions sim-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ use tokio::sync::Mutex;
use clap::Parser;
use log::LevelFilter;
use sim_lib::{
cln::ClnNode, lnd::LndNode, ActivityDefinition, Config, LightningError, LightningNode,
NodeConnection, NodeId, Simulation,
cln::ClnNode, lnd::LndNode, ActivityDefinition, LightningError, LightningNode, NodeConnection,
NodeId, SimParams, Simulation,
};
use simple_logger::SimpleLogger;

#[derive(Parser)]
#[command(version)]
struct Cli {
#[clap(long, short)]
config: PathBuf,
#[clap(index = 1)]
sim_file: PathBuf,
#[clap(long, short)]
total_time: Option<u32>,
/// Number of activity results to batch together before printing to csv file
Expand All @@ -37,8 +37,8 @@ async fn main() -> anyhow::Result<()> {
.init()
.unwrap();

let config_str = std::fs::read_to_string(cli.config)?;
let Config { nodes, activity } = serde_json::from_str(&config_str)?;
let SimParams { nodes, activity } =
serde_json::from_str(&std::fs::read_to_string(cli.sim_file)?)?;

let mut clients: HashMap<PublicKey, Arc<Mutex<dyn LightningNode + Send>>> = HashMap::new();
let mut pk_node_map = HashMap::new();
Expand Down
2 changes: 1 addition & 1 deletion sim-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl std::fmt::Display for NodeId {
}

#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Config {
pub struct SimParams {
pub nodes: Vec<NodeConnection>,
#[serde(default)]
pub activity: Vec<ActivityParser>,
Expand Down
Loading