Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: Introduce Announcers
✗ CI failure Lorenz Leutgeb committed 7 months ago
commit 71e812a8b72a6aa88051de4b211334e436e8362b
parent 8edd04c4e20ff710f827deab9dc2f2918a47ce1a
2 failed (2 total) View logs
3 files changed +15 -6
modified crates/radicle-protocol/src/service.rs
@@ -494,7 +494,7 @@ where
    G: crypto::signature::Signer<crypto::Signature>,
{
    pub fn new(
-
        config: Config,
+
        mut config: Config,
        db: Stores<D>,
        storage: S,
        policies: policy::Config<Write>,
@@ -509,6 +509,9 @@ where
        let clock = LocalTime::default(); // Updated on initialize.
        let inventory = gossip::inventory(clock.into(), []); // Updated on initialize.

+
        // For backwards compatibility, ensure that we are announcer of our own Node ID.
+
        config.announcers.insert(*signer.public_key());
+

        Self {
            config,
            storage,
@@ -1671,12 +1674,15 @@ where
                // from a new repository being initialized.
                self.seed_discovered(message.rid, *announcer, message.timestamp);

-
                // Update sync status of announcer for this repo.
-
                if let Some(refs) = refs.iter().find(|r| &r.remote == self.nid()) {
+
                // Update sync status of announcers for this repo.
+
                for refs in refs
+
                    .iter()
+
                    .filter(|r| self.config.announcers.contains(&r.remote))
+
                {
                    debug!(
                        target: "service",
-
                        "Refs announcement of {announcer} for {} contains our own remote at {} (t={})",
-
                        message.rid, refs.at, message.timestamp
+
                        "Refs announcement of {announcer} for {} contains announcer {} (t={})",
+
                        message.rid, refs, message.timestamp
                    );
                    match self.db.seeds_mut().synced(
                        &message.rid,
modified crates/radicle-schemars/src/main.rs
@@ -81,7 +81,7 @@ fn print_schema() -> io::Result<()> {

            #[derive(JsonSchema)]
            #[schemars(untagged)]
-
            #[allow(dead_code)]
+
            #[allow(dead_code, clippy::large_enum_variant)]
            enum CommandResult {
                Nid(radicle::node::NodeId),
                Config(radicle::node::Config),
modified crates/radicle/src/node/config.rs
@@ -467,6 +467,8 @@ pub struct Config {
    /// the environment variable `RAD_PASSPHRASE`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub secret: Option<std::path::PathBuf>,
+
    #[serde(default)]
+
    pub announcers: HashSet<super::NodeId>,
}

impl Config {
@@ -494,6 +496,7 @@ impl Config {
            seeding_policy: DefaultSeedingPolicy::default(),
            extra: json::Map::default(),
            secret: None,
+
            announcers: HashSet::new(),
        }
    }