Skip to content

Commit

Permalink
Implement custom Default for ModeConfig (informalsystems#1565)
Browse files Browse the repository at this point in the history
  • Loading branch information
soareschen committed Nov 15, 2021
1 parent 29c3515 commit 3abe7a5
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion relayer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ impl Config {
}
}

#[derive(Copy, Clone, Debug, Default, Deserialize, Serialize)]
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct ModeConfig {
pub clients: Clients,
Expand All @@ -180,6 +180,26 @@ impl ModeConfig {
}
}

impl Default for ModeConfig {
fn default() -> Self {
Self {
clients: Clients {
enabled: true,
refresh: true,
misbehaviour: true,
},
connections: Connections { enabled: false },
channels: Channels { enabled: false },
packets: Packets {
enabled: true,
clear_interval: default::clear_packets_interval(),
clear_on_start: true,
filter: false,
tx_confirmation: true,
},
}
}
}
#[derive(Copy, Clone, Debug, Default, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Clients {
Expand Down

0 comments on commit 3abe7a5

Please sign in to comment.