Reorganise command line options into more general engine.
This commit is contained in:
@@ -131,7 +131,8 @@ impl<V> Client<V> where V: Verifier {
|
||||
let mut dir = path.to_path_buf();
|
||||
dir.push(H64::from(spec.genesis_header().hash()).hex());
|
||||
//TODO: sec/fat: pruned/full versioning
|
||||
dir.push(format!("v{}-sec-{}", CLIENT_DB_VER_STR, if config.prefer_journal { "pruned" } else { "archive" }));
|
||||
// version here is a bit useless now, since it's controlled only be the pruning algo.
|
||||
dir.push(format!("v{}-sec-{}", CLIENT_DB_VER_STR, config.pruning));
|
||||
let path = dir.as_path();
|
||||
let gb = spec.genesis_block();
|
||||
let chain = Arc::new(BlockChain::new(config.blockchain, &gb, path));
|
||||
@@ -140,11 +141,7 @@ impl<V> Client<V> where V: Verifier {
|
||||
|
||||
let engine = Arc::new(try!(spec.to_engine()));
|
||||
let state_path_str = state_path.to_str().unwrap();
|
||||
let mut state_db = if config.prefer_journal {
|
||||
new_optiononedb(state_path_str)
|
||||
} else {
|
||||
new_archivedb(state_path_str)
|
||||
};
|
||||
let mut state_db = journaldb::new(state_path_str, config.pruning);
|
||||
|
||||
if state_db.is_empty() && engine.spec().ensure_db_good(state_db.as_hashdb_mut()) {
|
||||
state_db.commit(0, &engine.spec().genesis_header().hash(), None).expect("Error commiting genesis state to state DB");
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
pub use block_queue::BlockQueueConfig;
|
||||
pub use blockchain::BlockChainConfig;
|
||||
use util::journaldb;
|
||||
|
||||
/// Client configuration. Includes configs for all sub-systems.
|
||||
#[derive(Debug, Default)]
|
||||
@@ -24,8 +25,8 @@ pub struct ClientConfig {
|
||||
pub queue: BlockQueueConfig,
|
||||
/// Blockchain configuration.
|
||||
pub blockchain: BlockChainConfig,
|
||||
/// Prefer journal rather than archive.
|
||||
pub prefer_journal: bool,
|
||||
/// The JournalDB ("pruning") algorithm to use.
|
||||
pub pruning: journaldb::Algorithm,
|
||||
/// The name of the client instance.
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user