From 37a521169f703f5f412ea6dd52684b03289c350d Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 21 Nov 2026 22:21:56 +0000 Subject: roots: a seed joining itself names the root once it has it A joiner takes no root before each of its seeds named one, and a seed names its root only in a handshake. A seed that shook hands while joining itself named none, and never again: its joiner waited for ever. scripts/wire-check hit that (b joining a, c through b, d through c): b's reply to c came 2 ms before b had its document. Now a node notes the peers its handshakes named no root to, and once ready, shakes hands with them again, naming it. Older joiners take it too: it's a handshake as before. --- src/swarm/bootstrap.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/swarm/bootstrap.rs') diff --git a/src/swarm/bootstrap.rs b/src/swarm/bootstrap.rs index ed0c5cc..53b4af8 100644 --- a/src/swarm/bootstrap.rs +++ b/src/swarm/bootstrap.rs @@ -177,6 +177,17 @@ pub(crate) async fn bootstrap(state: &AppState, seeds: &[String], start: Start) state.mark_ready(swarm_id.clone()).await?; info!(swarm_id = %swarm_id, "Node is ready"); crate::swarm::peer::announce(state); + // Peers it named no root to while it had none, among them those joining + // through it, which wait for it to: a handshake again names it. + let unnamed = crate::swarm::roots::unnamed(state); + if !unnamed.is_empty() { + let state = state.clone(); + tokio::spawn(async move { + for peer in unnamed { + crate::swarm::peer::rehandshake(&state, &peer).await; + } + }); + } return Ok(()); } } -- cgit v1.3.1