Skip to content

Commit 9e49bd5

Browse files
fix 2
1 parent 8b36b2c commit 9e49bd5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

rust/cardano-chain-follower/examples/follow_chains.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ async fn start_sync_for(network: &Network, matches: ArgMatches) -> Result<(), Bo
9696
let mithril_dl_workers = format!("{}", dl_config.workers);
9797

9898
if let Some(chunk_size) = matches.get_one::<u16>("mithril-sync-chunk-size") {
99-
dl_config = dl_config.with_chunk_size(*chunk_size as usize * 1024 * 1024);
99+
let chunk_size = chunk_size
100+
.checked_mul(1024)
101+
.and_then(|v| v.checked_mul(1024))
102+
.ok_or_else(|| "Chunk size overflow")?;
103+
dl_config = dl_config.with_chunk_size(chunk_size);
100104
}
101105
let mithril_dl_chunk_size = format!("{} MBytes", dl_config.chunk_size / (1024 * 1024));
102106

0 commit comments

Comments
 (0)