parent
ba67b67ff3
commit
bbbaffbc53
@ -40,6 +40,8 @@ pub struct BlockChainConfig {
|
|||||||
pub pref_cache_size: usize,
|
pub pref_cache_size: usize,
|
||||||
/// Maximum cache size in bytes.
|
/// Maximum cache size in bytes.
|
||||||
pub max_cache_size: usize,
|
pub max_cache_size: usize,
|
||||||
|
/// Prefer journal rather than archive.
|
||||||
|
pub prefer_journal: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for BlockChainConfig {
|
impl Default for BlockChainConfig {
|
||||||
@ -47,6 +49,7 @@ impl Default for BlockChainConfig {
|
|||||||
BlockChainConfig {
|
BlockChainConfig {
|
||||||
pref_cache_size: 1 << 14,
|
pref_cache_size: 1 << 14,
|
||||||
max_cache_size: 1 << 20,
|
max_cache_size: 1 << 20,
|
||||||
|
prefer_journal: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,8 @@ impl Client {
|
|||||||
let mut dir = path.to_path_buf();
|
let mut dir = path.to_path_buf();
|
||||||
dir.push(H64::from(spec.genesis_header().hash()).hex());
|
dir.push(H64::from(spec.genesis_header().hash()).hex());
|
||||||
//TODO: sec/fat: pruned/full versioning
|
//TODO: sec/fat: pruned/full versioning
|
||||||
dir.push(format!("v{}-sec-pruned", CLIENT_DB_VER_STR));
|
dir.push(format!("v{}-sec-pruned-{}", CLIENT_DB_VER_STR, if config.blockchain.prefer_journal { "journal" } else { "archive" }));
|
||||||
|
let pj = config.blockchain.prefer_journal;
|
||||||
let path = dir.as_path();
|
let path = dir.as_path();
|
||||||
let gb = spec.genesis_block();
|
let gb = spec.genesis_block();
|
||||||
let chain = Arc::new(RwLock::new(BlockChain::new(config.blockchain, &gb, path)));
|
let chain = Arc::new(RwLock::new(BlockChain::new(config.blockchain, &gb, path)));
|
||||||
@ -220,7 +221,7 @@ impl Client {
|
|||||||
state_path.push("state");
|
state_path.push("state");
|
||||||
|
|
||||||
let engine = Arc::new(try!(spec.to_engine()));
|
let engine = Arc::new(try!(spec.to_engine()));
|
||||||
let mut state_db = JournalDB::new(state_path.to_str().unwrap());
|
let mut state_db = JournalDB::from_prefs(state_path.to_str().unwrap(), pj);
|
||||||
if state_db.is_empty() && engine.spec().ensure_db_good(&mut state_db) {
|
if state_db.is_empty() && engine.spec().ensure_db_good(&mut state_db) {
|
||||||
state_db.commit(0, &engine.spec().genesis_header().hash(), None).expect("Error commiting genesis state to state DB");
|
state_db.commit(0, &engine.spec().genesis_header().hash(), None).expect("Error commiting genesis state to state DB");
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,7 @@ Usage:
|
|||||||
Options:
|
Options:
|
||||||
--chain CHAIN Specify the blockchain type. CHAIN may be either a JSON chain specification file
|
--chain CHAIN Specify the blockchain type. CHAIN may be either a JSON chain specification file
|
||||||
or frontier, mainnet, morden, or testnet [default: frontier].
|
or frontier, mainnet, morden, or testnet [default: frontier].
|
||||||
|
--archive Client should not prune the state/storage trie.
|
||||||
-d --db-path PATH Specify the database & configuration directory path [default: $HOME/.parity]
|
-d --db-path PATH Specify the database & configuration directory path [default: $HOME/.parity]
|
||||||
--keys-path PATH Specify the path for JSON key files to be found [default: $HOME/.web3/keys]
|
--keys-path PATH Specify the path for JSON key files to be found [default: $HOME/.web3/keys]
|
||||||
|
|
||||||
@ -102,6 +103,7 @@ struct Args {
|
|||||||
flag_chain: String,
|
flag_chain: String,
|
||||||
flag_db_path: String,
|
flag_db_path: String,
|
||||||
flag_keys_path: String,
|
flag_keys_path: String,
|
||||||
|
flag_archive: bool,
|
||||||
flag_no_bootstrap: bool,
|
flag_no_bootstrap: bool,
|
||||||
flag_listen_address: String,
|
flag_listen_address: String,
|
||||||
flag_public_address: Option<String>,
|
flag_public_address: Option<String>,
|
||||||
@ -311,6 +313,7 @@ impl Configuration {
|
|||||||
let mut client_config = ClientConfig::default();
|
let mut client_config = ClientConfig::default();
|
||||||
client_config.blockchain.pref_cache_size = self.args.flag_cache_pref_size;
|
client_config.blockchain.pref_cache_size = self.args.flag_cache_pref_size;
|
||||||
client_config.blockchain.max_cache_size = self.args.flag_cache_max_size;
|
client_config.blockchain.max_cache_size = self.args.flag_cache_max_size;
|
||||||
|
client_config.blockchain.prefer_journal = !self.args.flag_archive;
|
||||||
client_config.queue.max_mem_use = self.args.flag_queue_max_size;
|
client_config.queue.max_mem_use = self.args.flag_queue_max_size;
|
||||||
let mut service = ClientService::start(client_config, spec, net_settings, &Path::new(&self.path())).unwrap();
|
let mut service = ClientService::start(client_config, spec, net_settings, &Path::new(&self.path())).unwrap();
|
||||||
let client = service.client().clone();
|
let client = service.client().clone();
|
||||||
|
Loading…
Reference in New Issue
Block a user