Skip to content

Commit

Permalink
refactor: add docs; polish up
Browse files Browse the repository at this point in the history
  • Loading branch information
b-zee authored and maqi committed Jan 22, 2025
1 parent 3a3446d commit 8f7f7c2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -727,12 +727,6 @@ jobs:
echo "EVM_NETWORK has been set to $EVM_NETWORK"
fi
# - name: Verify the routing tables of the nodes
# run: cargo test --release -p ant-node --test verify_routing_table -- --nocapture
# env:
# CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }}
# timeout-minutes: 5

- name: Verify the location of the data on the network
run: cargo test --release -p ant-node --test verify_data_location -- --nocapture
env:
Expand Down
3 changes: 3 additions & 0 deletions ant-bootstrap/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ pub struct BootstrapCacheConfig {

impl BootstrapCacheConfig {
/// Creates a new BootstrapConfig with default settings
///
/// When `local` is set to true, a different cache file name is used.
/// I.e. the file name will include `_local_` in the name.
pub fn default_config(local: bool) -> Result<Self> {
let cache_file_path = if local {
default_cache_path_local()?
Expand Down
9 changes: 2 additions & 7 deletions ant-networking/src/event/swarm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,23 +299,18 @@ impl SwarmDriver {
if address.iter().last() != Some(Protocol::P2p(local_peer_id)) {
address.push(Protocol::P2p(local_peer_id));
}
tracing::info!("========> A");

// Trigger server mode if we're not a client and we should not add our own address if we're behind
// home network.
if !self.is_client && !self.is_behind_home_network {
tracing::info!("========> B");
if self.local {
tracing::info!("========> C");
// all addresses are effectively external here...
// this is needed for Kad Mode::Server
self.swarm.add_external_address(address.clone());

// If we are local, add our own address(es) to cache
if let Some(bootstrap_cache) = self.bootstrap_cache.as_mut() {
tracing::info!(
"Adding our own address to bootstrap cache for local network"
);
tracing::info!("Adding listen address to bootstrap cache");

let config = bootstrap_cache.config().clone();
let mut old_cache = bootstrap_cache.clone();
Expand All @@ -324,7 +319,7 @@ impl SwarmDriver {
self.bootstrap_cache = Some(new);
old_cache.add_addr(address.clone());

// save the cache to disk
// Save cache to disk.
crate::time::spawn(async move {
if let Err(err) = old_cache.sync_and_flush_to_disk(true) {
error!("Failed to save bootstrap cache: {err}");
Expand Down

0 comments on commit 8f7f7c2

Please sign in to comment.