Skip to content

Commit 37b5978

Browse files
committed
fix(gossipsub): tweak configs to reduce duplicated msgs
1 parent 8cb5707 commit 37b5978

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

crates/p2p/src/swarm/behavior.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Request-Response [`Behaviour`] and [`NetworkBehaviour`] for the P2P protocol.
22
3-
use std::collections::HashSet;
3+
use std::{collections::HashSet, time::Duration};
44

55
use libp2p::{
66
allow_block_list::{AllowedPeers, Behaviour as AllowListBehaviour},
@@ -68,7 +68,15 @@ impl Behaviour {
6868
.validate_messages()
6969
.max_transmit_size(MAX_TRANSMIT_SIZE)
7070
// Avoids spamming the network and nodes with messages
71-
.idontwant_on_publish(true)
71+
.duplicate_cache_time(Duration::from_secs(60 * 5)) // default is 1 min
72+
.published_message_ids_cache_time(Duration::from_secs(60)) // default is 10
73+
.max_ihave_messages(100) // default is 10
74+
.gossip_retransimission(1) // default is 3
75+
.iwant_followup_time(Duration::from_secs(2)) // default is 3
76+
.gossip_lazy(2) // default is 6
77+
.gossip_factor(0.1) // default is 0.25
78+
.history_gossip(1) // default is 3
79+
.history_length(3) // default is 5
7280
.build()
7381
.expect("gossipsub config at this stage must be valid"),
7482
None,

0 commit comments

Comments
 (0)