Skip to content

Commit a8b1e0b

Browse files
authored
Merge branch 'bitcoin-dev-project:main' into update-ci-version
2 parents 2486b64 + f272dec commit a8b1e0b

File tree

6 files changed

+145
-88
lines changed

6 files changed

+145
-88
lines changed

Cargo.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sim-cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ rand = "0.8.5"
2525
hex = {version = "0.4.3"}
2626
futures = "0.3.30"
2727
console-subscriber = { version = "0.4.0", optional = true}
28+
tokio-util = { version = "0.7.13", features = ["rt"] }
2829

2930
[features]
3031
dev = ["console-subscriber"]

sim-cli/src/main.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::collections::HashMap;
1212
use std::path::PathBuf;
1313
use std::sync::Arc;
1414
use tokio::sync::Mutex;
15+
use tokio_util::task::TaskTracker;
1516

1617
/// The default directory where the simulation files are stored and where the results will be written to.
1718
pub const DEFAULT_DATA_DIR: &str = ".";
@@ -209,6 +210,7 @@ async fn main() -> anyhow::Result<()> {
209210
None
210211
};
211212

213+
let tasks = TaskTracker::new();
212214
let sim = Simulation::new(
213215
SimulationCfg::new(
214216
cli.total_time,
@@ -219,6 +221,7 @@ async fn main() -> anyhow::Result<()> {
219221
),
220222
clients,
221223
validated_activities,
224+
tasks,
222225
);
223226
let sim2 = sim.clone();
224227

@@ -233,16 +236,18 @@ async fn main() -> anyhow::Result<()> {
233236
}
234237

235238
async fn read_sim_path(data_dir: PathBuf, sim_file: PathBuf) -> anyhow::Result<PathBuf> {
236-
let sim_path = if sim_file.is_relative() {
237-
data_dir.join(sim_file)
238-
} else {
239-
sim_file
240-
};
241-
242-
if sim_path.exists() {
243-
Ok(sim_path)
239+
if sim_file.exists() {
240+
Ok(sim_file)
241+
} else if sim_file.is_relative() {
242+
let sim_path = data_dir.join(sim_file);
243+
if sim_path.exists() {
244+
Ok(sim_path)
245+
} else {
246+
log::info!("Simulation file '{}' does not exist.", sim_path.display());
247+
select_sim_file(data_dir).await
248+
}
244249
} else {
245-
log::info!("Simulation file '{}' does not exist.", sim_path.display());
250+
log::info!("Simulation file '{}' does not exist.", sim_file.display());
246251
select_sim_file(data_dir).await
247252
}
248253
}

simln-lib/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ serde_millis = "0.1.1"
3232
rand_distr = "0.4.3"
3333
mockall = "0.12.1"
3434
rand_chacha = "0.3.1"
35+
tokio-util = { version = "0.7.13", features = ["rt"] }
3536

3637
[dev-dependencies]
3738
ntest = "0.9.0"

0 commit comments

Comments
 (0)