From 8d6a4344deddff2bc9f6674d486041b6e1ea419d Mon Sep 17 00:00:00 2001 From: mikhailUshakoff Date: Thu, 9 Jan 2025 15:31:35 +0100 Subject: [PATCH] Changed the message validation mode to Strict --- p2pNode/p2pNetwork/src/network.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/p2pNode/p2pNetwork/src/network.rs b/p2pNode/p2pNetwork/src/network.rs index d454453..b9bc539 100644 --- a/p2pNode/p2pNetwork/src/network.rs +++ b/p2pNode/p2pNetwork/src/network.rs @@ -77,7 +77,7 @@ impl P2PNetwork { .max_transmit_size(10 * 1_048_576) .fanout_ttl(Duration::from_secs(60)) .heartbeat_interval(Duration::from_millis(10_000)) - .validation_mode(ValidationMode::Anonymous) + .validation_mode(ValidationMode::Strict) .fanout_ttl(Duration::from_secs(60)) .history_length(12) .max_messages_per_rpc(Some(500)) @@ -85,9 +85,12 @@ impl P2PNetwork { .build() .expect("Valid config"); + // build a message authenticity + let message_authenticity = MessageAuthenticity::Signed(config.local_key.clone()); + // build a gossipsub network behaviour let mut gossipsub = - gossipsub::Behaviour::new(MessageAuthenticity::Anonymous, gossipsub_config) + gossipsub::Behaviour::new(message_authenticity, gossipsub_config) .expect("Correct configuration"); // Create a Gossipsub topic