Skip to content

Commit

Permalink
feat(config): stop reading consensus constants from config file
Browse files Browse the repository at this point in the history
From now on, consensus constants shall be only defined at
compile time.
  • Loading branch information
aesedepece committed Jun 24, 2020
1 parent 705701a commit 6ce5011
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,23 +369,8 @@ impl Config {
Environment::Testnet => &Testnet,
};

let consensus_constants = match config.environment {
// When in mainnet, ignore the [consensus_constants] section of the configuration
Environment::Mainnet => {
let consensus_constants_no_changes = PartialConsensusConstants::default();
// Warn the user if the config file contains a non-empty [consensus_constant] section
if config.consensus_constants != consensus_constants_no_changes {
log::warn!(
"Consensus constants in the configuration are ignored when running mainnet"
);
}
consensus_constants_from_partial(&consensus_constants_no_changes, defaults)
}
// In testnet, allow to override the consensus constants
Environment::Testnet => {
consensus_constants_from_partial(&config.consensus_constants, defaults)
}
};
let consensus_constants =
consensus_constants_from_partial(&PartialConsensusConstants::default(), defaults);

Config {
environment: config.environment,
Expand Down

0 comments on commit 6ce5011

Please sign in to comment.