diff --git a/radicle-cli/src/commands/init.rs b/radicle-cli/src/commands/init.rs index 2a3f62a7..e676b8c3 100644 --- a/radicle-cli/src/commands/init.rs +++ b/radicle-cli/src/commands/init.rs @@ -210,7 +210,7 @@ pub fn init(options: Options, profile: &profile::Profile) -> anyhow::Result<()> Ok((id, doc, _)) => { let proj = doc.project()?; - if options.track { + if options.track && node.is_running() { // It's important to track our own repositories to make sure that our node signals // interest for them. This ensures that messages relating to them are relayed to us. node.track_repo(id)?; diff --git a/radicle-node/src/service.rs b/radicle-node/src/service.rs index 7a0be30a..6172abad 100644 --- a/radicle-node/src/service.rs +++ b/radicle-node/src/service.rs @@ -359,9 +359,18 @@ where for (id, addr) in addrs { self.connect(id, addr); } - // Ensure that our inventory is recorded in our routing table. - for id in self.storage.inventory()? { - self.routing.insert(id, self.node_id(), time.as_millis())?; + // Ensure that our inventory is recorded in our routing table, and we are tracking + // all of it. It can happen that inventory is not properly tracked if for eg. the + // user creates a new repository while the node is stopped. + for rid in self.storage.inventory()? { + self.routing.insert(rid, self.node_id(), time.as_millis())?; + + if self + .track_repo(&rid, tracking::Scope::All) + .expect("Service::command: error tracking repository") + { + info!(target: "service", "Tracking local repository {rid}"); + } } // Setup subscription filter for tracked repos. self.filter = Filter::new(