Skip to content

Commit 8a6d027

Browse files
committed
Use network parameter in archive filename
1 parent 868e086 commit 8a6d027

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

mithril-aggregator/src/http_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ mod handlers {
413413
let snapshot_store = snapshot_store.read().await;
414414
match snapshot_store.get_snapshot_details(digest).await {
415415
Ok(Some(snapshot)) => {
416-
let filename = format!("testnet.{}.tar.gz", snapshot.digest);
416+
let filename = format!("{}.{}.tar.gz", config.network, snapshot.digest);
417417
let snapshot_uri = format!(
418418
"{}/{}/snapshot_download/{}",
419419
config.server_url, SERVER_BASE_PATH, filename

mithril-aggregator/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ async fn main() -> Result<(), String> {
141141
let handle = tokio::spawn(async move {
142142
let runtime = AggregatorRuntime::new(
143143
args.snapshot_interval * 1000,
144+
config.network.clone(),
144145
config.db_directory.clone(),
145146
snapshot_directory,
146147
beacon_store.clone(),

mithril-aggregator/src/runtime.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ pub struct AggregatorRuntime {
4848
/// Interval between each snapshot, in seconds
4949
interval: u32,
5050

51+
/// Cardano network
52+
network: String,
53+
5154
/// DB directory to snapshot
5255
db_directory: PathBuf,
5356

@@ -71,6 +74,7 @@ impl AggregatorRuntime {
7174
/// AggregatorRuntime factory
7275
pub fn new(
7376
interval: u32,
77+
network: String,
7478
db_directory: PathBuf,
7579
snapshot_directory: PathBuf,
7680
beacon_store: BeaconStoreWrapper,
@@ -80,6 +84,7 @@ impl AggregatorRuntime {
8084
) -> Self {
8185
Self {
8286
interval,
87+
network,
8388
db_directory,
8489
snapshot_directory,
8590
beacon_store,
@@ -119,7 +124,8 @@ impl AggregatorRuntime {
119124

120125
match self.manage_trigger_snapshot(&message, &beacon).await {
121126
Ok(true) => {
122-
let snapshot_name = format!("testnet.{}.tar.gz", &digest_result.digest);
127+
let snapshot_name =
128+
format!("{}.{}.tar.gz", self.network, &digest_result.digest);
123129
let snapshot_path = snapshotter.snapshot(&snapshot_name)?;
124130

125131
let uploaded_snapshot_location = self

0 commit comments

Comments
 (0)