Use proper database configuration in snapshots. (#2052)
* use proper database config in snapshot service * add snapshot path to parity directories struct * fix RPC tests
This commit is contained in:
committed by
Arkadiy Paronyan
parent
541b14a4ab
commit
57d5c35bb6
@@ -28,7 +28,16 @@ use rlp::{Rlp, View};
|
||||
fn imports_from_empty() {
|
||||
let dir = RandomTempPath::new();
|
||||
let spec = get_test_spec();
|
||||
let client = Client::new(ClientConfig::default(), &spec, dir.as_path(), Arc::new(Miner::with_spec(&spec)), IoChannel::disconnected()).unwrap();
|
||||
let db_config = DatabaseConfig::with_columns(::db::NUM_COLUMNS);
|
||||
|
||||
let client = Client::new(
|
||||
ClientConfig::default(),
|
||||
&spec,
|
||||
dir.as_path(),
|
||||
Arc::new(Miner::with_spec(&spec)),
|
||||
IoChannel::disconnected(),
|
||||
&db_config
|
||||
).unwrap();
|
||||
client.import_verified_blocks();
|
||||
client.flush_queue();
|
||||
}
|
||||
@@ -37,7 +46,16 @@ fn imports_from_empty() {
|
||||
fn should_return_registrar() {
|
||||
let dir = RandomTempPath::new();
|
||||
let spec = ethereum::new_morden();
|
||||
let client = Client::new(ClientConfig::default(), &spec, dir.as_path(), Arc::new(Miner::with_spec(&spec)), IoChannel::disconnected()).unwrap();
|
||||
let db_config = DatabaseConfig::with_columns(::db::NUM_COLUMNS);
|
||||
|
||||
let client = Client::new(
|
||||
ClientConfig::default(),
|
||||
&spec,
|
||||
dir.as_path(),
|
||||
Arc::new(Miner::with_spec(&spec)),
|
||||
IoChannel::disconnected(),
|
||||
&db_config
|
||||
).unwrap();
|
||||
assert_eq!(client.additional_params().get("registrar"), Some(&"8e4e9b13d4b45cb0befc93c3061b1408f67316b2".to_owned()));
|
||||
}
|
||||
|
||||
@@ -55,7 +73,16 @@ fn returns_state_root_basic() {
|
||||
fn imports_good_block() {
|
||||
let dir = RandomTempPath::new();
|
||||
let spec = get_test_spec();
|
||||
let client = Client::new(ClientConfig::default(), &spec, dir.as_path(), Arc::new(Miner::with_spec(&spec)), IoChannel::disconnected()).unwrap();
|
||||
let db_config = DatabaseConfig::with_columns(::db::NUM_COLUMNS);
|
||||
|
||||
let client = Client::new(
|
||||
ClientConfig::default(),
|
||||
&spec,
|
||||
dir.as_path(),
|
||||
Arc::new(Miner::with_spec(&spec)),
|
||||
IoChannel::disconnected(),
|
||||
&db_config
|
||||
).unwrap();
|
||||
let good_block = get_good_dummy_block();
|
||||
if let Err(_) = client.import_block(good_block) {
|
||||
panic!("error importing block being good by definition");
|
||||
@@ -71,8 +98,16 @@ fn imports_good_block() {
|
||||
fn query_none_block() {
|
||||
let dir = RandomTempPath::new();
|
||||
let spec = get_test_spec();
|
||||
let client = Client::new(ClientConfig::default(), &spec, dir.as_path(), Arc::new(Miner::with_spec(&spec)), IoChannel::disconnected()).unwrap();
|
||||
let db_config = DatabaseConfig::with_columns(::db::NUM_COLUMNS);
|
||||
|
||||
let client = Client::new(
|
||||
ClientConfig::default(),
|
||||
&spec,
|
||||
dir.as_path(),
|
||||
Arc::new(Miner::with_spec(&spec)),
|
||||
IoChannel::disconnected(),
|
||||
&db_config
|
||||
).unwrap();
|
||||
let non_existant = client.block_header(BlockID::Number(188));
|
||||
assert!(non_existant.is_none());
|
||||
}
|
||||
|
||||
@@ -133,9 +133,17 @@ pub fn generate_dummy_client_with_data(block_number: u32, txs_per_block: usize,
|
||||
|
||||
pub fn generate_dummy_client_with_spec_and_data<F>(get_test_spec: F, block_number: u32, txs_per_block: usize, tx_gas_prices: &[U256]) -> GuardedTempResult<Arc<Client>> where F: Fn()->Spec {
|
||||
let dir = RandomTempPath::new();
|
||||
|
||||
let test_spec = get_test_spec();
|
||||
let client = Client::new(ClientConfig::default(), &test_spec, dir.as_path(), Arc::new(Miner::with_spec(&test_spec)), IoChannel::disconnected()).unwrap();
|
||||
let db_config = DatabaseConfig::with_columns(::db::NUM_COLUMNS);
|
||||
|
||||
let client = Client::new(
|
||||
ClientConfig::default(),
|
||||
&test_spec,
|
||||
dir.as_path(),
|
||||
Arc::new(Miner::with_spec(&test_spec)),
|
||||
IoChannel::disconnected(),
|
||||
&db_config
|
||||
).unwrap();
|
||||
let test_engine = &*test_spec.engine;
|
||||
|
||||
let mut db_result = get_temp_journal_db();
|
||||
@@ -233,7 +241,17 @@ pub fn push_blocks_to_client(client: &Arc<Client>, timestamp_salt: u64, starting
|
||||
pub fn get_test_client_with_blocks(blocks: Vec<Bytes>) -> GuardedTempResult<Arc<Client>> {
|
||||
let dir = RandomTempPath::new();
|
||||
let test_spec = get_test_spec();
|
||||
let client = Client::new(ClientConfig::default(), &test_spec, dir.as_path(), Arc::new(Miner::with_spec(&test_spec)), IoChannel::disconnected()).unwrap();
|
||||
let db_config = DatabaseConfig::with_columns(::db::NUM_COLUMNS);
|
||||
|
||||
let client = Client::new(
|
||||
ClientConfig::default(),
|
||||
&test_spec,
|
||||
dir.as_path(),
|
||||
Arc::new(Miner::with_spec(&test_spec)),
|
||||
IoChannel::disconnected(),
|
||||
&db_config
|
||||
).unwrap();
|
||||
|
||||
for block in &blocks {
|
||||
if let Err(_) = client.import_block(block.clone()) {
|
||||
panic!("panic importing block which is well-formed");
|
||||
|
||||
@@ -25,18 +25,23 @@ use devtools::*;
|
||||
use miner::Miner;
|
||||
use crossbeam;
|
||||
use io::IoChannel;
|
||||
use util::kvdb::DatabaseConfig;
|
||||
|
||||
pub fn run_test_worker(scope: &crossbeam::Scope, stop: Arc<AtomicBool>, socket_path: &str) {
|
||||
let socket_path = socket_path.to_owned();
|
||||
scope.spawn(move || {
|
||||
let temp = RandomTempPath::create_dir();
|
||||
let spec = get_test_spec();
|
||||
let db_config = DatabaseConfig::with_columns(::db::NUM_COLUMNS);
|
||||
|
||||
let client = Client::new(
|
||||
ClientConfig::default(),
|
||||
&spec,
|
||||
temp.as_path(),
|
||||
Arc::new(Miner::with_spec(&spec)),
|
||||
IoChannel::disconnected()).unwrap();
|
||||
IoChannel::disconnected(),
|
||||
&db_config
|
||||
).unwrap();
|
||||
let mut worker = nanoipc::Worker::new(&(client as Arc<BlockChainClient>));
|
||||
worker.add_reqrep(&socket_path).unwrap();
|
||||
while !stop.load(Ordering::Relaxed) {
|
||||
|
||||
Reference in New Issue
Block a user