Add snappy encoding to gossipsub messages (#984)

* Add snappy encode/decode to gossip messages

* Fix gossipsub tests
This commit is contained in:
Pawan Dhananjay
2020-04-05 13:59:14 +05:30
committed by GitHub
parent cc63c2b769
commit d7e2938296
7 changed files with 128 additions and 65 deletions

View File

@@ -8,6 +8,8 @@ use sha2::{Digest, Sha256};
use std::path::PathBuf;
use std::time::Duration;
pub const GOSSIP_MAX_SIZE: usize = 1_048_576;
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(default)]
/// Network configuration for lighthouse.
@@ -98,7 +100,7 @@ impl Default for Config {
// Note: The topics by default are sent as plain strings. Hashes are an optional
// parameter.
let gs_config = GossipsubConfigBuilder::new()
.max_transmit_size(1_048_576)
.max_transmit_size(GOSSIP_MAX_SIZE)
.heartbeat_interval(Duration::from_secs(20)) // TODO: Reduce for mainnet
.manual_propagation() // require validation before propagation
.no_source_id()