2020-01-17 14:27:28 +01:00
|
|
|
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
2019-01-07 11:33:07 +01:00
|
|
|
// This file is part of Parity Ethereum.
|
2016-02-05 13:40:41 +01:00
|
|
|
|
2019-01-07 11:33:07 +01:00
|
|
|
// Parity Ethereum is free software: you can redistribute it and/or modify
|
2016-02-05 13:40:41 +01:00
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
2019-01-07 11:33:07 +01:00
|
|
|
// Parity Ethereum is distributed in the hope that it will be useful,
|
2016-02-05 13:40:41 +01:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
2019-01-07 11:33:07 +01:00
|
|
|
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
2016-02-05 13:40:41 +01:00
|
|
|
|
2016-02-02 15:29:53 +01:00
|
|
|
//! Creates and registers client and network services.
|
|
|
|
|
2017-07-29 21:56:42 +02:00
|
|
|
use std::path::Path;
|
2019-06-26 14:16:58 +02:00
|
|
|
use std::sync::Arc;
|
2018-04-14 21:35:58 +02:00
|
|
|
use std::time::Duration;
|
2018-03-13 11:49:57 +01:00
|
|
|
|
|
|
|
use ansi_term::Colour;
|
2018-08-29 14:31:04 +02:00
|
|
|
use ethereum_types::H256;
|
2018-03-13 11:49:57 +01:00
|
|
|
use io::{IoContext, TimerToken, IoHandler, IoService, IoError};
|
2019-09-03 11:29:25 +02:00
|
|
|
use client_traits::ChainNotify;
|
2018-04-10 12:13:49 +02:00
|
|
|
use sync::PrivateTxHandler;
|
2019-01-04 14:05:46 +01:00
|
|
|
use blockchain::{BlockChainDB, BlockChainDBHandler};
|
2019-09-03 11:29:25 +02:00
|
|
|
use ethcore::client::{Client, ClientConfig};
|
2018-03-13 11:49:57 +01:00
|
|
|
use ethcore::miner::Miner;
|
2019-09-03 11:29:25 +02:00
|
|
|
use snapshot::service::{Service as SnapshotService, ServiceParams as SnapServiceParams};
|
2019-09-10 22:44:33 +02:00
|
|
|
use snapshot::{SnapshotService as _SnapshotService, SnapshotClient};
|
2019-08-23 15:32:58 +02:00
|
|
|
use spec::Spec;
|
2019-08-22 18:25:49 +02:00
|
|
|
use common_types::{
|
2019-08-28 10:09:42 +02:00
|
|
|
io_message::ClientIoMessage,
|
2019-08-22 18:25:49 +02:00
|
|
|
errors::{EthcoreError, SnapshotError},
|
|
|
|
snapshot::RestorationStatus,
|
|
|
|
};
|
2019-09-10 22:44:33 +02:00
|
|
|
use client_traits::{ImportBlock, Tick};
|
2019-06-19 10:13:09 +02:00
|
|
|
|
2018-04-09 16:14:33 +02:00
|
|
|
|
2019-02-07 14:34:24 +01:00
|
|
|
use ethcore_private_tx::{self, Importer, Signer};
|
2018-04-09 16:14:33 +02:00
|
|
|
|
|
|
|
pub struct PrivateTxService {
|
|
|
|
provider: Arc<ethcore_private_tx::Provider>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl PrivateTxService {
|
|
|
|
fn new(provider: Arc<ethcore_private_tx::Provider>) -> Self {
|
|
|
|
PrivateTxService {
|
|
|
|
provider,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Returns underlying provider.
|
|
|
|
pub fn provider(&self) -> Arc<ethcore_private_tx::Provider> {
|
|
|
|
self.provider.clone()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl PrivateTxHandler for PrivateTxService {
|
2018-08-29 14:31:04 +02:00
|
|
|
fn import_private_transaction(&self, rlp: &[u8]) -> Result<H256, String> {
|
|
|
|
match self.provider.import_private_transaction(rlp) {
|
|
|
|
Ok(import_result) => Ok(import_result),
|
|
|
|
Err(err) => {
|
|
|
|
warn!(target: "privatetx", "Unable to import private transaction packet: {}", err);
|
2019-06-17 08:44:59 +02:00
|
|
|
return Err(err.to_string())
|
2018-08-29 14:31:04 +02:00
|
|
|
}
|
|
|
|
}
|
2018-04-09 16:14:33 +02:00
|
|
|
}
|
|
|
|
|
2018-08-29 14:31:04 +02:00
|
|
|
fn import_signed_private_transaction(&self, rlp: &[u8]) -> Result<H256, String> {
|
|
|
|
match self.provider.import_signed_private_transaction(rlp) {
|
|
|
|
Ok(import_result) => Ok(import_result),
|
|
|
|
Err(err) => {
|
|
|
|
warn!(target: "privatetx", "Unable to import signed private transaction packet: {}", err);
|
2019-06-17 08:44:59 +02:00
|
|
|
return Err(err.to_string())
|
2018-08-29 14:31:04 +02:00
|
|
|
}
|
|
|
|
}
|
2018-04-09 16:14:33 +02:00
|
|
|
}
|
2019-08-16 14:45:52 +02:00
|
|
|
|
|
|
|
fn private_state_synced(&self, hash: &H256) -> Result<(), String> {
|
|
|
|
match self.provider.private_state_synced(hash) {
|
|
|
|
Ok(handle_result) => Ok(handle_result),
|
|
|
|
Err(err) => {
|
|
|
|
warn!(target: "privatetx", "Unable to handle private state synced message: {}", err);
|
|
|
|
return Err(err.to_string())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-04-09 16:14:33 +02:00
|
|
|
}
|
2016-01-21 23:33:52 +01:00
|
|
|
|
2016-01-15 01:03:29 +01:00
|
|
|
/// Client service setup. Creates and registers client and network services with the IO subsystem.
|
2016-01-13 23:15:53 +01:00
|
|
|
pub struct ClientService {
|
2019-08-28 10:09:42 +02:00
|
|
|
io_service: Arc<IoService<ClientIoMessage<Client>>>,
|
2016-01-21 23:33:52 +01:00
|
|
|
client: Arc<Client>,
|
2019-09-03 11:29:25 +02:00
|
|
|
snapshot: Arc<SnapshotService<Client>>,
|
2018-04-09 16:14:33 +02:00
|
|
|
private_tx: Arc<PrivateTxService>,
|
2019-08-27 17:29:33 +02:00
|
|
|
database: Arc<dyn BlockChainDB>,
|
2016-01-13 23:15:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
impl ClientService {
|
2016-09-07 15:27:28 +02:00
|
|
|
/// Start the `ClientService`.
|
2016-07-11 17:02:42 +02:00
|
|
|
pub fn start(
|
|
|
|
config: ClientConfig,
|
2016-08-05 23:33:55 +02:00
|
|
|
spec: &Spec,
|
2019-08-27 17:29:33 +02:00
|
|
|
blockchain_db: Arc<dyn BlockChainDB>,
|
2016-09-07 15:27:28 +02:00
|
|
|
snapshot_path: &Path,
|
2019-08-27 17:29:33 +02:00
|
|
|
restoration_db_handler: Box<dyn BlockChainDBHandler>,
|
2017-10-16 17:50:25 +02:00
|
|
|
_ipc_path: &Path,
|
2016-07-11 17:02:42 +02:00
|
|
|
miner: Arc<Miner>,
|
2019-08-27 17:29:33 +02:00
|
|
|
signer: Arc<dyn Signer>,
|
|
|
|
encryptor: Box<dyn ethcore_private_tx::Encryptor>,
|
2018-04-09 16:14:33 +02:00
|
|
|
private_tx_conf: ethcore_private_tx::ProviderConfig,
|
2019-02-07 12:39:04 +01:00
|
|
|
private_encryptor_conf: ethcore_private_tx::EncryptorConfig,
|
2019-06-26 14:16:58 +02:00
|
|
|
) -> Result<ClientService, EthcoreError>
|
2016-07-11 17:02:42 +02:00
|
|
|
{
|
2019-08-28 10:09:42 +02:00
|
|
|
let io_service = IoService::<ClientIoMessage<Client>>::start()?;
|
2016-02-10 16:35:52 +01:00
|
|
|
|
2019-08-22 18:25:49 +02:00
|
|
|
info!("Configured for {} using {} engine", Colour::White.bold().paint(spec.name.clone()), Colour::Yellow.bold().paint(spec.engine.name().to_string()));
|
2016-08-05 17:00:46 +02:00
|
|
|
|
2016-09-07 15:27:28 +02:00
|
|
|
let pruning = config.pruning;
|
2018-11-28 11:30:05 +01:00
|
|
|
let client = Client::new(
|
|
|
|
config,
|
|
|
|
&spec,
|
|
|
|
blockchain_db.clone(),
|
|
|
|
miner.clone(),
|
|
|
|
io_service.channel(),
|
|
|
|
)?;
|
2019-06-24 15:10:42 +02:00
|
|
|
spec.engine.register_client(Arc::downgrade(&client) as _);
|
2018-07-13 12:23:57 +02:00
|
|
|
miner.set_io_channel(io_service.channel());
|
2018-08-17 17:01:32 +02:00
|
|
|
miner.set_in_chain_checker(&client.clone());
|
2016-09-07 15:27:28 +02:00
|
|
|
|
|
|
|
let snapshot_params = SnapServiceParams {
|
|
|
|
engine: spec.engine.clone(),
|
|
|
|
genesis_block: spec.genesis_block(),
|
2019-07-08 23:01:47 +02:00
|
|
|
restoration_db_handler,
|
|
|
|
pruning,
|
2016-09-07 15:27:28 +02:00
|
|
|
channel: io_service.channel(),
|
|
|
|
snapshot_root: snapshot_path.into(),
|
2018-11-18 00:06:34 +01:00
|
|
|
client: client.clone(),
|
2016-09-07 15:27:28 +02:00
|
|
|
};
|
2016-12-27 12:53:56 +01:00
|
|
|
let snapshot = Arc::new(SnapshotService::new(snapshot_params)?);
|
2016-08-05 17:00:46 +02:00
|
|
|
|
2019-02-07 12:39:04 +01:00
|
|
|
let private_keys = Arc::new(ethcore_private_tx::SecretStoreKeys::new(
|
|
|
|
client.clone(),
|
|
|
|
private_encryptor_conf.key_server_account,
|
|
|
|
));
|
2018-04-13 17:34:27 +02:00
|
|
|
let provider = Arc::new(ethcore_private_tx::Provider::new(
|
2019-02-07 12:39:04 +01:00
|
|
|
client.clone(),
|
|
|
|
miner,
|
2019-02-07 14:34:24 +01:00
|
|
|
signer,
|
2019-02-07 12:39:04 +01:00
|
|
|
encryptor,
|
|
|
|
private_tx_conf,
|
|
|
|
io_service.channel(),
|
|
|
|
private_keys,
|
2019-08-16 14:45:52 +02:00
|
|
|
blockchain_db.key_value().clone(),
|
2018-05-09 08:49:34 +02:00
|
|
|
));
|
2019-08-16 14:45:52 +02:00
|
|
|
let private_tx = Arc::new(PrivateTxService::new(provider.clone()));
|
|
|
|
io_service.register_handler(provider)?;
|
2018-04-09 16:14:33 +02:00
|
|
|
|
2016-01-21 16:48:37 +01:00
|
|
|
let client_io = Arc::new(ClientIoHandler {
|
2016-08-05 17:00:46 +02:00
|
|
|
client: client.clone(),
|
|
|
|
snapshot: snapshot.clone(),
|
2016-01-13 23:15:53 +01:00
|
|
|
});
|
2016-12-27 12:53:56 +01:00
|
|
|
io_service.register_handler(client_io)?;
|
2016-01-13 23:15:53 +01:00
|
|
|
|
|
|
|
Ok(ClientService {
|
2016-07-11 17:02:42 +02:00
|
|
|
io_service: Arc::new(io_service),
|
2019-08-28 10:09:42 +02:00
|
|
|
client,
|
|
|
|
snapshot,
|
2018-04-09 16:14:33 +02:00
|
|
|
private_tx,
|
2018-06-20 15:13:07 +02:00
|
|
|
database: blockchain_db,
|
2016-01-13 23:15:53 +01:00
|
|
|
})
|
|
|
|
}
|
2016-01-16 13:30:27 +01:00
|
|
|
|
2016-01-29 15:56:06 +01:00
|
|
|
/// Get general IO interface
|
2019-08-28 10:09:42 +02:00
|
|
|
pub fn register_io_handler(&self, handler: Arc<dyn IoHandler<ClientIoMessage<Client>> + Send>) -> Result<(), IoError> {
|
2016-07-11 17:02:42 +02:00
|
|
|
self.io_service.register_handler(handler)
|
2016-01-16 13:30:27 +01:00
|
|
|
}
|
|
|
|
|
2016-01-29 15:56:06 +01:00
|
|
|
/// Get client interface
|
2016-01-21 23:33:52 +01:00
|
|
|
pub fn client(&self) -> Arc<Client> {
|
2016-01-16 13:30:27 +01:00
|
|
|
self.client.clone()
|
2016-01-22 04:54:38 +01:00
|
|
|
}
|
2016-01-29 15:56:06 +01:00
|
|
|
|
2016-08-05 17:00:46 +02:00
|
|
|
/// Get snapshot interface.
|
2019-09-03 11:29:25 +02:00
|
|
|
pub fn snapshot_service(&self) -> Arc<SnapshotService<Client>> {
|
2016-08-05 17:00:46 +02:00
|
|
|
self.snapshot.clone()
|
|
|
|
}
|
|
|
|
|
2018-04-09 16:14:33 +02:00
|
|
|
/// Get private transaction service.
|
|
|
|
pub fn private_tx_service(&self) -> Arc<PrivateTxService> {
|
|
|
|
self.private_tx.clone()
|
|
|
|
}
|
|
|
|
|
2016-01-29 15:56:06 +01:00
|
|
|
/// Get network service component
|
2019-08-28 10:09:42 +02:00
|
|
|
pub fn io(&self) -> Arc<IoService<ClientIoMessage<Client>>> {
|
2016-07-11 17:02:42 +02:00
|
|
|
self.io_service.clone()
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Set the actor to be notified on certain chain events
|
2019-08-27 17:29:33 +02:00
|
|
|
pub fn add_notify(&self, notify: Arc<dyn ChainNotify>) {
|
2016-07-20 12:36:20 +02:00
|
|
|
self.client.add_notify(notify);
|
2016-01-16 13:30:27 +01:00
|
|
|
}
|
2017-02-20 17:21:55 +01:00
|
|
|
|
|
|
|
/// Get a handle to the database.
|
2019-08-27 17:29:33 +02:00
|
|
|
pub fn db(&self) -> Arc<dyn BlockChainDB> { self.database.clone() }
|
2018-05-29 12:23:15 +02:00
|
|
|
|
|
|
|
/// Shutdown the Client Service
|
|
|
|
pub fn shutdown(&self) {
|
2019-06-19 10:13:09 +02:00
|
|
|
trace!(target: "shutdown", "Shutting down Client Service");
|
2018-05-29 12:23:15 +02:00
|
|
|
self.snapshot.shutdown();
|
|
|
|
}
|
2016-01-13 23:15:53 +01:00
|
|
|
}
|
|
|
|
|
2016-01-15 01:03:29 +01:00
|
|
|
/// IO interface for the Client handler
|
2019-09-03 11:29:25 +02:00
|
|
|
struct ClientIoHandler<C: Send + Sync + 'static> {
|
2019-08-28 10:09:42 +02:00
|
|
|
client: Arc<C>,
|
2019-09-03 11:29:25 +02:00
|
|
|
snapshot: Arc<SnapshotService<C>>,
|
2016-01-13 23:15:53 +01:00
|
|
|
}
|
|
|
|
|
2016-01-21 17:21:51 +01:00
|
|
|
const CLIENT_TICK_TIMER: TimerToken = 0;
|
2016-09-06 17:44:11 +02:00
|
|
|
const SNAPSHOT_TICK_TIMER: TimerToken = 1;
|
|
|
|
|
2018-04-14 21:35:58 +02:00
|
|
|
const CLIENT_TICK: Duration = Duration::from_secs(5);
|
|
|
|
const SNAPSHOT_TICK: Duration = Duration::from_secs(10);
|
2016-01-21 17:21:51 +01:00
|
|
|
|
2019-08-28 10:09:42 +02:00
|
|
|
impl<C> IoHandler<ClientIoMessage<C>> for ClientIoHandler<C>
|
|
|
|
where
|
|
|
|
C: ImportBlock + SnapshotClient + Tick + 'static,
|
|
|
|
{
|
|
|
|
fn initialize(&self, io: &IoContext<ClientIoMessage<C>>) {
|
2018-04-14 21:35:58 +02:00
|
|
|
io.register_timer(CLIENT_TICK_TIMER, CLIENT_TICK).expect("Error registering client timer");
|
|
|
|
io.register_timer(SNAPSHOT_TICK_TIMER, SNAPSHOT_TICK).expect("Error registering snapshot timer");
|
2016-01-21 17:21:51 +01:00
|
|
|
}
|
|
|
|
|
2019-08-28 10:09:42 +02:00
|
|
|
fn timeout(&self, _io: &IoContext<ClientIoMessage<C>>, timer: TimerToken) {
|
2018-05-09 08:49:34 +02:00
|
|
|
trace_time!("service::read");
|
2016-09-06 17:44:11 +02:00
|
|
|
match timer {
|
2017-10-10 20:30:11 +02:00
|
|
|
CLIENT_TICK_TIMER => {
|
2019-09-03 11:29:25 +02:00
|
|
|
use snapshot::SnapshotService;
|
2017-10-10 20:30:11 +02:00
|
|
|
let snapshot_restoration = if let RestorationStatus::Ongoing{..} = self.snapshot.status() { true } else { false };
|
|
|
|
self.client.tick(snapshot_restoration)
|
|
|
|
},
|
2016-09-06 17:44:11 +02:00
|
|
|
SNAPSHOT_TICK_TIMER => self.snapshot.tick(),
|
|
|
|
_ => warn!("IO service triggered unregistered timer '{}'", timer),
|
2016-01-21 17:21:51 +01:00
|
|
|
}
|
2016-01-16 18:30:27 +01:00
|
|
|
}
|
2016-01-13 23:15:53 +01:00
|
|
|
|
2019-08-28 10:09:42 +02:00
|
|
|
fn message(&self, _io: &IoContext<ClientIoMessage<C>>, net_message: &ClientIoMessage<C>) {
|
2018-05-09 08:49:34 +02:00
|
|
|
trace_time!("service::message");
|
2016-11-01 11:09:46 +01:00
|
|
|
use std::thread;
|
|
|
|
|
2016-07-06 18:28:11 +02:00
|
|
|
match *net_message {
|
2018-05-09 08:49:34 +02:00
|
|
|
ClientIoMessage::BlockVerified => {
|
|
|
|
self.client.import_verified_blocks();
|
2016-12-10 14:56:41 +01:00
|
|
|
}
|
2016-08-25 22:20:44 +02:00
|
|
|
ClientIoMessage::BeginRestoration(ref manifest) => {
|
2016-09-11 14:05:59 +02:00
|
|
|
if let Err(e) = self.snapshot.init_restore(manifest.clone(), true) {
|
2016-08-25 22:20:44 +02:00
|
|
|
warn!("Failed to initialize snapshot restoration: {}", e);
|
|
|
|
}
|
|
|
|
}
|
2018-05-09 08:49:34 +02:00
|
|
|
ClientIoMessage::FeedStateChunk(ref hash, ref chunk) => {
|
|
|
|
self.snapshot.feed_state_chunk(*hash, chunk)
|
|
|
|
}
|
|
|
|
ClientIoMessage::FeedBlockChunk(ref hash, ref chunk) => {
|
|
|
|
self.snapshot.feed_block_chunk(*hash, chunk)
|
|
|
|
}
|
2016-09-02 16:15:25 +02:00
|
|
|
ClientIoMessage::TakeSnapshot(num) => {
|
2016-11-01 11:09:46 +01:00
|
|
|
let client = self.client.clone();
|
|
|
|
let snapshot = self.snapshot.clone();
|
|
|
|
let res = thread::Builder::new().name("Periodic Snapshot".into()).spawn(move || {
|
|
|
|
if let Err(e) = snapshot.take_snapshot(&*client, num) {
|
2019-06-19 10:13:09 +02:00
|
|
|
match e {
|
|
|
|
EthcoreError::Snapshot(SnapshotError::SnapshotAborted) => info!("Snapshot aborted"),
|
|
|
|
_ => warn!("Failed to take snapshot at block #{}: {}", num, e),
|
|
|
|
}
|
2016-11-01 11:09:46 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if let Err(e) = res {
|
|
|
|
debug!(target: "snapshot", "Failed to initialize periodic snapshot thread: {:?}", e);
|
2016-09-02 16:15:25 +02:00
|
|
|
}
|
2016-09-27 12:12:18 +02:00
|
|
|
},
|
2018-05-09 08:49:34 +02:00
|
|
|
ClientIoMessage::Execute(ref exec) => {
|
|
|
|
(*exec.0)(&self.client);
|
|
|
|
}
|
2016-07-06 18:28:11 +02:00
|
|
|
_ => {} // ignore other messages
|
2016-01-13 23:15:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-30 14:00:36 +01:00
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
2019-12-03 16:59:11 +01:00
|
|
|
use std::collections::HashMap;
|
2016-05-31 22:24:32 +02:00
|
|
|
use std::sync::Arc;
|
2018-03-13 11:49:57 +01:00
|
|
|
use std::{time, thread};
|
|
|
|
|
2018-01-19 17:32:53 +01:00
|
|
|
use tempdir::TempDir;
|
2016-01-30 14:15:37 +01:00
|
|
|
|
2019-01-04 14:05:46 +01:00
|
|
|
use ethcore_db::NUM_COLUMNS;
|
2018-03-13 11:49:57 +01:00
|
|
|
use ethcore::client::ClientConfig;
|
|
|
|
use ethcore::miner::Miner;
|
2019-08-23 15:32:58 +02:00
|
|
|
use spec;
|
2018-06-20 15:13:07 +02:00
|
|
|
use ethcore::test_helpers;
|
|
|
|
use kvdb_rocksdb::{DatabaseConfig, CompactionProfile};
|
2018-03-13 11:49:57 +01:00
|
|
|
use super::*;
|
|
|
|
|
2018-04-09 16:14:33 +02:00
|
|
|
use ethcore_private_tx;
|
|
|
|
|
2016-01-30 14:00:36 +01:00
|
|
|
#[test]
|
|
|
|
fn it_can_be_started() {
|
2018-01-19 17:32:53 +01:00
|
|
|
let tempdir = TempDir::new("").unwrap();
|
|
|
|
let client_path = tempdir.path().join("client");
|
|
|
|
let snapshot_path = tempdir.path().join("snapshot");
|
2016-08-05 17:00:46 +02:00
|
|
|
|
2018-04-09 14:21:37 +02:00
|
|
|
let mut client_db_config = DatabaseConfig::with_columns(NUM_COLUMNS);
|
|
|
|
|
2019-12-03 16:59:11 +01:00
|
|
|
client_db_config.memory_budget = HashMap::new();
|
2018-04-09 14:21:37 +02:00
|
|
|
client_db_config.compaction = CompactionProfile::auto(&client_path);
|
|
|
|
|
2018-06-20 15:13:07 +02:00
|
|
|
let client_db_handler = test_helpers::restoration_db_handler(client_db_config.clone());
|
|
|
|
let client_db = client_db_handler.open(&client_path).unwrap();
|
|
|
|
let restoration_db_handler = test_helpers::restoration_db_handler(client_db_config);
|
2018-04-09 14:21:37 +02:00
|
|
|
|
2019-08-07 16:52:48 +02:00
|
|
|
let spec = spec::new_test();
|
2016-06-23 21:04:23 +02:00
|
|
|
let service = ClientService::start(
|
|
|
|
ClientConfig::default(),
|
2016-08-05 23:33:55 +02:00
|
|
|
&spec,
|
2018-04-09 14:21:37 +02:00
|
|
|
client_db,
|
2016-09-07 15:27:28 +02:00
|
|
|
&snapshot_path,
|
2018-04-09 14:21:37 +02:00
|
|
|
restoration_db_handler,
|
2018-01-19 17:32:53 +01:00
|
|
|
tempdir.path(),
|
2018-04-13 17:34:27 +02:00
|
|
|
Arc::new(Miner::new_for_tests(&spec, None)),
|
2019-02-07 14:34:24 +01:00
|
|
|
Arc::new(ethcore_private_tx::DummySigner),
|
2018-04-09 16:14:33 +02:00
|
|
|
Box::new(ethcore_private_tx::NoopEncryptor),
|
2018-04-13 17:34:27 +02:00
|
|
|
Default::default(),
|
2019-02-07 12:39:04 +01:00
|
|
|
Default::default(),
|
2016-06-23 21:04:23 +02:00
|
|
|
);
|
2016-01-30 14:00:36 +01:00
|
|
|
assert!(service.is_ok());
|
2016-08-17 15:53:34 +02:00
|
|
|
drop(service.unwrap());
|
2018-01-19 17:32:53 +01:00
|
|
|
thread::park_timeout(time::Duration::from_millis(100));
|
2016-01-30 14:00:36 +01:00
|
|
|
}
|
2016-02-02 15:29:53 +01:00
|
|
|
}
|