From c534b25dbd94dc41731f98e4c4b2a170fe02c347 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 16 Nov 2026 20:44:13 +0000 Subject: handshake: the party its sender is of In a swarm holding a store, a node's handshakes name the party it is of (`docs/store.md`, Members), so that a peer tells whether it is a member before its entry reaches it: HELLO and HELLO_REPLY carry `party`, as `--store-party` says, None elsewhere and without the `federation` feature. Wire format version 52. --- src/swarm/peer/handshake.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/swarm/peer') diff --git a/src/swarm/peer/handshake.rs b/src/swarm/peer/handshake.rs index 8e9b0ef..4cc0cf4 100644 --- a/src/swarm/peer/handshake.rs +++ b/src/swarm/peer/handshake.rs @@ -142,6 +142,7 @@ async fn transmit_hello(state: &AppState, peer: &str) -> Result<()> { root: crate::swarm::roots::own(state) .await .map(|root| root.0.to_vec()), + party: party(state), }), ) .await; @@ -242,6 +243,7 @@ pub(super) async fn send_hello_reply( root: crate::swarm::roots::own(state) .await .map(|root| root.0.to_vec()), + party: party(state), }; debug!(to = %peer, ready, "Sending HELLO_REPLY"); @@ -471,3 +473,15 @@ pub(crate) async fn peer_swarm(state: &AppState, peer: &str) -> Option { let peer_state = peer_state_mutex.lock().await; peer_state.standing.swarm_id().map(str::to_owned) } + +/// The party this node is of, as its handshakes name it, in a swarm holding a store +/// (`--store-party`); None elsewhere. +fn party(state: &AppState) -> Option { + #[cfg(feature = "federation")] + return state.holding.party().map(str::to_owned); + #[cfg(not(feature = "federation"))] + { + let _ = state; + None + } +} -- cgit v1.3.1