Skip to content

Commit

Permalink
fix(bootstrap): set cache_dir during init
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandSherwin committed Mar 4, 2025
1 parent 53082f4 commit 31d5fa1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ant-bootstrap/src/cache_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,23 @@ impl BootstrapCacheStore {
}

/// Create an empty CacheStore from the given peers argument.
/// This also modifies the cfg if provided based on the PeersArgs.
/// And also performs some actions based on the PeersArgs.
/// This also modifies provided config based on the PeersArgs.
///
/// `PeersArgs::bootstrap_cache_dir` will take precedence over the path provided inside `config`.
pub fn new_from_peers_args(
peers_arg: &PeersArgs,
config: Option<BootstrapCacheConfig>,
) -> Result<Self> {
let config = if let Some(cfg) = config {
let mut config = if let Some(cfg) = config {
cfg
} else {
BootstrapCacheConfig::new(peers_arg.local)?
};

if let Some(cache_dir) = &peers_arg.bootstrap_cache_dir {
config.cache_dir = cache_dir.clone();
}

let store = Self::new(config)?;

// If it is the first node, clear the cache.
Expand Down

0 comments on commit 31d5fa1

Please sign in to comment.