diff --git a/Cargo.toml b/Cargo.toml index 716c68fcb7..9899408acf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ qp2p = "~0.12.0" rand = "~0.7.3" rand_chacha = "~0.2.2" resource_proof = "0.8.0" -sn_messaging = "36.0.1" +sn_messaging = "37.0.0" sn_data_types = "~0.18.3" thiserror = "1.0.23" tokio = "1.3.0" diff --git a/src/routing/core/api.rs b/src/routing/core/api.rs index 1eb7658e0f..530bb086db 100644 --- a/src/routing/core/api.rs +++ b/src/routing/core/api.rs @@ -22,7 +22,7 @@ use secured_linked_list::SecuredLinkedList; use sn_messaging::{ node::{Network, NodeState, Peer, Proposal, RoutingMsg, Section, Variant}, section_info::Error as TargetSectionError, - DestInfo, EndUser, Itinerary, SectionAuthorityProvider, SrcLocation, + DestInfo, EndUser, Itinerary, MessageId, SectionAuthorityProvider, SrcLocation, }; use std::net::SocketAddr; use tokio::sync::mpsc; @@ -294,7 +294,13 @@ impl Core { pub fn set_joins_allowed(&self, joins_allowed: bool) -> Result> { let mut commands = Vec::new(); if self.is_elder() && joins_allowed != self.joins_allowed { - commands.extend(self.propose(Proposal::JoinsAllowed(joins_allowed))?); + let active_members: Vec = self + .section + .active_members() + .map(|peer| *peer.name()) + .collect(); + let msg_id = MessageId::from_content(&active_members)?; + commands.extend(self.propose(Proposal::JoinsAllowed((msg_id, joins_allowed)))?); } Ok(commands) } diff --git a/src/routing/core/messaging/handling/agreement.rs b/src/routing/core/messaging/handling/agreement.rs index d93d01c721..bfefa2b5e1 100644 --- a/src/routing/core/messaging/handling/agreement.rs +++ b/src/routing/core/messaging/handling/agreement.rs @@ -81,7 +81,7 @@ impl Core { )?]) } Proposal::JoinsAllowed(joins_allowed) => { - self.joins_allowed = joins_allowed; + self.joins_allowed = joins_allowed.1; Ok(vec![]) } } diff --git a/src/routing/core/mod.rs b/src/routing/core/mod.rs index d5d21f4b91..ae4d329a47 100644 --- a/src/routing/core/mod.rs +++ b/src/routing/core/mod.rs @@ -21,6 +21,7 @@ use crate::{ messages::RoutingMsgUtils, network::NetworkUtils, node::Node, + peer::PeerUtils, relocation::RelocateState, section::{SectionAuthorityProviderUtils, SectionKeyShare, SectionKeysProvider, SectionUtils}, }; @@ -168,7 +169,15 @@ impl Core { commands.extend(self.promote_and_demote_elders()?); // Whenever there is an elders change, casting a round of joins_allowed // proposals to sync. - commands.extend(self.propose(Proposal::JoinsAllowed(self.joins_allowed))?); + let active_members: Vec = self + .section + .active_members() + .map(|peer| *peer.name()) + .collect(); + let msg_id = MessageId::from_content(&active_members)?; + commands.extend( + self.propose(Proposal::JoinsAllowed((msg_id, self.joins_allowed)))?, + ); } self.print_network_stats();