Skip to content

Commit 0cdf44b

Browse files
committed
Add network to immutable digests json cache filename
This will reduce the needs to remove them completly if an user change its configuration to run on another networks, else cached digests from the previous network would have been reused.
1 parent 2d45fb6 commit 0cdf44b

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

mithril-aggregator/src/command_args.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,9 @@ impl ServeCommand {
359359
let digester = Arc::new(CardanoImmutableDigester::new(
360360
config.db_directory.clone(),
361361
Arc::new(JsonImmutableFileDigestCacheProvider::new(
362-
&config.data_stores_directory.join("immutables_digests.json"),
362+
&config
363+
.data_stores_directory
364+
.join(format!("immutables_digests_{}.json", config.network)),
363365
)),
364366
slog_scope::logger(),
365367
));

mithril-client/src/commands/restore.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl RestoreCommand {
4646
debug!("{:?}", config);
4747
let mut runtime = Runtime::new(config.network.clone());
4848
let aggregator_handler =
49-
AggregatorHTTPClient::new(config.network.clone(), config.aggregator_endpoint);
49+
AggregatorHTTPClient::new(config.network.clone(), config.aggregator_endpoint.clone());
5050
let certificate_verifier = Box::new(MithrilCertificateVerifier::new(slog_scope::logger()));
5151
let genesis_verification_key = key_decode_hex(&config.genesis_verification_key)?;
5252
let genesis_verifier =
@@ -55,7 +55,7 @@ impl RestoreCommand {
5555

5656
let digester = Box::new(CardanoImmutableDigester::new(
5757
Path::new(&unpacked_path).into(),
58-
build_digester_cache_provider(self.disable_digest_cache)?,
58+
build_digester_cache_provider(self.disable_digest_cache, &config)?,
5959
slog_scope::logger(),
6060
));
6161
let output = runtime
@@ -87,6 +87,7 @@ docker run -v cardano-node-ipc:/ipc -v cardano-node-data:/data --mount type=bind
8787

8888
fn build_digester_cache_provider(
8989
disable_digest_cache: bool,
90+
config: &Config,
9091
) -> Result<Arc<dyn ImmutableFileDigestCacheProvider>, Box<dyn Error>> {
9192
if disable_digest_cache {
9293
return Ok(Arc::new(MemoryImmutableFileDigestCacheProvider::default()));
@@ -103,7 +104,7 @@ fn build_digester_cache_provider(
103104
std::fs::create_dir_all(cache_dir)?;
104105
}
105106

106-
let cache_file = cache_dir.join("immutables_digests.json");
107+
let cache_file = cache_dir.join(format!("immutables_digests_{}.json", config.network));
107108
info!(
108109
"Storing/Getting immutables digests cache from: {}",
109110
cache_file.display()

mithril-signer/src/runtime/signer_services.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl<'a> ServiceBuilder for ProductionServiceBuilder<'a> {
9191
&self
9292
.config
9393
.data_stores_directory
94-
.join("immutables_digests.json"),
94+
.join(format!("immutables_digests_{}.json", self.config.network)),
9595
)),
9696
slog_scope::logger(),
9797
));

0 commit comments

Comments
 (0)