fix: all fast sync nodes report to peers as full nodes (#1547)

* fix: all fast sync nodes report to peers as full nodes
This commit is contained in:
Gary Yu
2018-09-20 07:09:39 +08:00
committed by GitHub
parent 2ca6ecc163
commit 56ffbee7e9
4 changed files with 34 additions and 4 deletions
+26
View File
@@ -157,6 +157,32 @@ pub struct ServerConfig {
pub stratum_mining_config: Option<StratumServerConfig>,
}
impl ServerConfig {
/// Configuration items validation check
pub fn validation_check(&mut self) {
// check [server.p2p_config.capabilities] with 'archive_mode' in [server]
if let Some(archive) = self.archive_mode {
// note: slog not available before config loaded, only print here.
if archive != self
.p2p_config
.capabilities
.contains(p2p::Capabilities::FULL_HIST)
{
// if conflict, 'archive_mode' win
self.p2p_config
.capabilities
.toggle(p2p::Capabilities::FULL_HIST);
println!(
"ServerConfig - capabilities conflict with archive_mode: {}, force to: {:?}",
archive, self.p2p_config.capabilities,
); // note: slog not available before config loaded, only print here.
}
}
// todo: other checks if needed
}
}
impl Default for ServerConfig {
fn default() -> ServerConfig {
ServerConfig {