Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: mark dns address connected time on peer store #4793

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

driftluo
Copy link
Collaborator

What problem does this PR solve?

Mark DNS address connected time on peer store, allow it to spread across multiple nodes.

The transmission path is as follows:

  • DNS address public with identify protocol
    }
    });
    self.network_state.with_peer_store_mut(|peer_store| {
    for addr in addrs {
    if let Err(err) = peer_store.add_addr(addr.clone(), flags) {
    error!("IdentifyProtocol failed to add address to peer store, address: {}, error: {:?}", addr, err);
    }
    }
    })
    }
  • discovery protocol will random fetch it from peer store when it had connected during last week
    let max = ::std::cmp::min(MAX_ADDR_TO_SEND, count as usize);
    if items.len() > max {
    items = items
    .choose_multiple(&mut rand::thread_rng(), max)
    .cloned()
    .collect();
    }
    state.addr_known.extend(items.iter());
    let items = items
  • peer store random fetch
    pub fn fetch_random_addrs(&mut self, count: usize, required_flags: Flags) -> Vec<AddrInfo> {
    // Get info:
    // 1. Connected within 7 days
    let now_ms = ckb_systemtime::unix_time_as_millis();

Check List

Tests

  • Unit test
  • Integration test

Release note

Title Only: Include only the PR title in the release note.

@driftluo driftluo requested a review from a team as a code owner January 21, 2025 07:38
@driftluo driftluo requested review from quake and removed request for a team January 21, 2025 07:38
eval-exec
eval-exec previously approved these changes Jan 21, 2025
@driftluo driftluo force-pushed the mark-connected-dns-connected-time branch from 142cfa0 to 5a8dec2 Compare January 24, 2025 08:30
@driftluo driftluo requested review from eval-exec and quake February 5, 2025 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants