Remove private transactions
This commit is contained in:
@@ -60,13 +60,6 @@ mod accounts {
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
pub fn private_tx_signer(
|
||||
_account_provider: Arc<AccountProvider>,
|
||||
_passwords: &[Password],
|
||||
) -> Result<Arc<dyn ethcore_private_tx::Signer>, String> {
|
||||
Ok(Arc::new(::ethcore_private_tx::DummySigner))
|
||||
}
|
||||
|
||||
pub fn accounts_list(
|
||||
_account_provider: Arc<AccountProvider>,
|
||||
) -> Arc<dyn Fn() -> Vec<Address> + Send + Sync> {
|
||||
@@ -218,62 +211,6 @@ mod accounts {
|
||||
Ok(author)
|
||||
}
|
||||
|
||||
mod private_tx {
|
||||
use super::*;
|
||||
use ethcore_private_tx::Error;
|
||||
use ethkey::{Message, Signature};
|
||||
|
||||
pub struct AccountSigner {
|
||||
pub accounts: Arc<AccountProvider>,
|
||||
pub passwords: Vec<Password>,
|
||||
}
|
||||
|
||||
impl ::ethcore_private_tx::Signer for AccountSigner {
|
||||
fn decrypt(
|
||||
&self,
|
||||
account: Address,
|
||||
shared_mac: &[u8],
|
||||
payload: &[u8],
|
||||
) -> Result<Vec<u8>, Error> {
|
||||
let password = self.find_account_password(&account);
|
||||
Ok(self
|
||||
.accounts
|
||||
.decrypt(account, password, shared_mac, payload)
|
||||
.map_err(|e| e.to_string())?)
|
||||
}
|
||||
|
||||
fn sign(&self, account: Address, hash: Message) -> Result<Signature, Error> {
|
||||
let password = self.find_account_password(&account);
|
||||
Ok(self
|
||||
.accounts
|
||||
.sign(account, password, hash)
|
||||
.map_err(|e| e.to_string())?)
|
||||
}
|
||||
}
|
||||
|
||||
impl AccountSigner {
|
||||
/// Try to unlock account using stored password, return found password if any
|
||||
fn find_account_password(&self, account: &Address) -> Option<Password> {
|
||||
for password in &self.passwords {
|
||||
if let Ok(true) = self.accounts.test_password(account, password) {
|
||||
return Some(password.clone());
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn private_tx_signer(
|
||||
accounts: Arc<AccountProvider>,
|
||||
passwords: &[Password],
|
||||
) -> Result<Arc<dyn crate::ethcore_private_tx::Signer>, String> {
|
||||
Ok(Arc::new(self::private_tx::AccountSigner {
|
||||
accounts,
|
||||
passwords: passwords.to_vec(),
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn accounts_list(
|
||||
account_provider: Arc<AccountProvider>,
|
||||
) -> Arc<dyn Fn() -> Vec<Address> + Send + Sync> {
|
||||
@@ -318,6 +255,5 @@ mod accounts {
|
||||
}
|
||||
|
||||
pub use self::accounts::{
|
||||
accounts_list, miner_author, miner_local_accounts, prepare_account_provider, private_tx_signer,
|
||||
AccountProvider,
|
||||
accounts_list, miner_author, miner_local_accounts, prepare_account_provider, AccountProvider,
|
||||
};
|
||||
|
||||
@@ -29,7 +29,6 @@ use ethcore::{
|
||||
miner::Miner,
|
||||
verification::queue::VerifierSettings,
|
||||
};
|
||||
use ethcore_private_tx;
|
||||
use ethcore_service::ClientService;
|
||||
use ethereum_types::{Address, H256, U256};
|
||||
use hash::{keccak, KECCAK_NULL_RLP};
|
||||
@@ -211,10 +210,6 @@ fn execute_import(cmd: ImportBlockchain) -> Result<(), String> {
|
||||
// TODO [ToDr] don't use test miner here
|
||||
// (actually don't require miner at all)
|
||||
Arc::new(Miner::new_for_tests(&spec, None)),
|
||||
Arc::new(ethcore_private_tx::DummySigner),
|
||||
Box::new(ethcore_private_tx::NoopEncryptor),
|
||||
Default::default(),
|
||||
Default::default(),
|
||||
)
|
||||
.map_err(|e| format!("Client service error: {:?}", e))?;
|
||||
|
||||
@@ -350,10 +345,6 @@ fn start_client(
|
||||
// It's fine to use test version here,
|
||||
// since we don't care about miner parameters at all
|
||||
Arc::new(Miner::new_for_tests(&spec, None)),
|
||||
Arc::new(ethcore_private_tx::DummySigner),
|
||||
Box::new(ethcore_private_tx::NoopEncryptor),
|
||||
Default::default(),
|
||||
Default::default(),
|
||||
)
|
||||
.map_err(|e| format!("Client service error: {:?}", e))?;
|
||||
|
||||
|
||||
@@ -300,35 +300,6 @@ usage! {
|
||||
"--password=[FILE]...",
|
||||
"Provide a file containing a password for unlocking an account. Leading and trailing whitespace is trimmed.",
|
||||
|
||||
["Private Transactions Options"]
|
||||
FLAG flag_private_enabled: (bool) = false, or |c: &Config| c.private_tx.as_ref()?.enabled,
|
||||
"--private-tx-enabled",
|
||||
"Enable private transactions.",
|
||||
|
||||
ARG arg_private_signer: (Option<String>) = None, or |c: &Config| c.private_tx.as_ref()?.signer.clone(),
|
||||
"--private-signer=[ACCOUNT]",
|
||||
"Specify the account for signing public transaction created upon verified private transaction.",
|
||||
|
||||
ARG arg_private_validators: (Option<String>) = None, or |c: &Config| c.private_tx.as_ref()?.validators.as_ref().map(|vec| vec.join(",")),
|
||||
"--private-validators=[ACCOUNTS]",
|
||||
"Specify the accounts for validating private transactions. ACCOUNTS is a comma-delimited list of addresses.",
|
||||
|
||||
ARG arg_private_account: (Option<String>) = None, or |c: &Config| c.private_tx.as_ref()?.account.clone(),
|
||||
"--private-account=[ACCOUNT]",
|
||||
"Specify the account for signing requests to secret store.",
|
||||
|
||||
ARG arg_private_sstore_url: (Option<String>) = None, or |c: &Config| c.private_tx.as_ref()?.sstore_url.clone(),
|
||||
"--private-sstore-url=[URL]",
|
||||
"Specify secret store URL used for encrypting private transactions.",
|
||||
|
||||
ARG arg_private_sstore_threshold: (Option<u32>) = None, or |c: &Config| c.private_tx.as_ref()?.sstore_threshold.clone(),
|
||||
"--private-sstore-threshold=[NUM]",
|
||||
"Specify secret store threshold used for encrypting private transactions.",
|
||||
|
||||
ARG arg_private_passwords: (Option<String>) = None, or |c: &Config| c.private_tx.as_ref()?.passwords.clone(),
|
||||
"--private-passwords=[FILE]...",
|
||||
"Provide a file containing passwords for unlocking accounts (signer, private account, validators).",
|
||||
|
||||
["UI Options"]
|
||||
ARG arg_ui_path: (String) = "$BASE/signer", or |c: &Config| c.ui.as_ref()?.path.clone(),
|
||||
"--ui-path=[PATH]",
|
||||
@@ -438,7 +409,7 @@ usage! {
|
||||
"--jsonrpc-interface=[IP]",
|
||||
"Specify the hostname portion of the HTTP JSON-RPC API server, IP should be an interface's IP address, or all (all interfaces) or local.",
|
||||
|
||||
ARG arg_jsonrpc_apis: (String) = "web3,eth,pubsub,net,parity,private,parity_pubsub,traces", or |c: &Config| c.rpc.as_ref()?.apis.as_ref().map(|vec| vec.join(",")),
|
||||
ARG arg_jsonrpc_apis: (String) = "web3,eth,pubsub,net,parity,parity_pubsub,traces", or |c: &Config| c.rpc.as_ref()?.apis.as_ref().map(|vec| vec.join(",")),
|
||||
"--jsonrpc-apis=[APIS]",
|
||||
"Specify the APIs available through the HTTP JSON-RPC interface using a comma-delimited list of API names. Possible names are: all, safe, debug, web3, net, eth, pubsub, personal, signer, parity, parity_pubsub, parity_accounts, parity_set, traces, secretstore. You can also disable a specific API by putting '-' in the front, example: all,-personal. 'safe' enables the following APIs: web3, net, eth, pubsub, parity, parity_pubsub, traces",
|
||||
|
||||
@@ -479,7 +450,7 @@ usage! {
|
||||
"--ws-interface=[IP]",
|
||||
"Specify the hostname portion of the WebSockets JSON-RPC server, IP should be an interface's IP address, or all (all interfaces) or local.",
|
||||
|
||||
ARG arg_ws_apis: (String) = "web3,eth,pubsub,net,parity,parity_pubsub,private,traces", or |c: &Config| c.websockets.as_ref()?.apis.as_ref().map(|vec| vec.join(",")),
|
||||
ARG arg_ws_apis: (String) = "web3,eth,pubsub,net,parity,parity_pubsub,traces", or |c: &Config| c.websockets.as_ref()?.apis.as_ref().map(|vec| vec.join(",")),
|
||||
"--ws-apis=[APIS]",
|
||||
"Specify the JSON-RPC APIs available through the WebSockets interface using a comma-delimited list of API names. Possible names are: all, safe, web3, net, eth, pubsub, personal, signer, parity, parity_pubsub, parity_accounts, parity_set, traces, secretstore. You can also disable a specific API by putting '-' in the front, example: all,-personal. 'safe' enables the following APIs: web3, net, eth, pubsub, parity, parity_pubsub, traces",
|
||||
|
||||
@@ -504,7 +475,7 @@ usage! {
|
||||
"--ipc-path=[PATH]",
|
||||
"Specify custom path for JSON-RPC over IPC service.",
|
||||
|
||||
ARG arg_ipc_apis: (String) = "web3,eth,pubsub,net,parity,parity_pubsub,parity_accounts,private,traces", or |c: &Config| c.ipc.as_ref()?.apis.as_ref().map(|vec| vec.join(",")),
|
||||
ARG arg_ipc_apis: (String) = "web3,eth,pubsub,net,parity,parity_pubsub,parity_accounts,traces", or |c: &Config| c.ipc.as_ref()?.apis.as_ref().map(|vec| vec.join(",")),
|
||||
"--ipc-apis=[APIS]",
|
||||
"Specify custom API set available via JSON-RPC over IPC using a comma-delimited list of API names. Possible names are: all, safe, web3, net, eth, pubsub, personal, signer, parity, parity_pubsub, parity_accounts, parity_set, traces, secretstore. You can also disable a specific API by putting '-' in the front, example: all,-personal. 'safe' enables the following APIs: web3, net, eth, pubsub, parity, parity_pubsub, traces",
|
||||
|
||||
@@ -832,7 +803,6 @@ struct Config {
|
||||
websockets: Option<Ws>,
|
||||
ipc: Option<Ipc>,
|
||||
secretstore: Option<SecretStore>,
|
||||
private_tx: Option<PrivateTransactions>,
|
||||
mining: Option<Mining>,
|
||||
footprint: Option<Footprint>,
|
||||
snapshots: Option<Snapshots>,
|
||||
@@ -864,18 +834,6 @@ struct Account {
|
||||
fast_unlock: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, PartialEq, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct PrivateTransactions {
|
||||
enabled: Option<bool>,
|
||||
signer: Option<String>,
|
||||
validators: Option<Vec<String>>,
|
||||
account: Option<String>,
|
||||
passwords: Option<String>,
|
||||
sstore_url: Option<String>,
|
||||
sstore_threshold: Option<u32>,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, PartialEq, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct Ui {
|
||||
@@ -1297,15 +1255,6 @@ mod tests {
|
||||
arg_accounts_refresh: 5u64,
|
||||
flag_fast_unlock: false,
|
||||
|
||||
// -- Private Transactions Options
|
||||
flag_private_enabled: true,
|
||||
arg_private_signer: Some("0xdeadbeefcafe0000000000000000000000000000".into()),
|
||||
arg_private_validators: Some("0xdeadbeefcafe0000000000000000000000000000".into()),
|
||||
arg_private_passwords: Some("~/.safe/password.file".into()),
|
||||
arg_private_account: Some("0xdeadbeefcafe0000000000000000000000000000".into()),
|
||||
arg_private_sstore_url: Some("http://localhost:8082".into()),
|
||||
arg_private_sstore_threshold: Some(0),
|
||||
|
||||
arg_ui_path: "$HOME/.parity/signer".into(),
|
||||
|
||||
// -- Networking Options
|
||||
@@ -1576,7 +1525,6 @@ mod tests {
|
||||
http_port: Some(8082),
|
||||
path: None,
|
||||
}),
|
||||
private_tx: None,
|
||||
mining: Some(Mining {
|
||||
author: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
|
||||
engine_signer: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
|
||||
|
||||
@@ -15,15 +15,6 @@ unlock = ["0xdeadbeefcafe0000000000000000000000000000"]
|
||||
password = ["~/.safe/password.file"]
|
||||
keys_iterations = 10240
|
||||
|
||||
[private_tx]
|
||||
enabled = true
|
||||
signer = "0xdeadbeefcafe0000000000000000000000000000"
|
||||
validators = ["0xdeadbeefcafe0000000000000000000000000000"]
|
||||
passwords = "~/.safe/password.file"
|
||||
account = "0xdeadbeefcafe0000000000000000000000000000"
|
||||
sstore_url = "http://localhost:8082"
|
||||
sstore_threshold = 0
|
||||
|
||||
[ui]
|
||||
path = "$HOME/.parity/signer"
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ use dir::{
|
||||
Directories,
|
||||
};
|
||||
use ethcore_logger::Config as LogConfig;
|
||||
use ethcore_private_tx::{EncryptorConfig, ProviderConfig};
|
||||
use helpers::{
|
||||
parity_ipc_path, to_address, to_addresses, to_block_id, to_bootnodes, to_duration, to_mode,
|
||||
to_pending_set, to_price, to_queue_penalization, to_queue_strategy, to_u256,
|
||||
@@ -382,8 +381,6 @@ impl Configuration {
|
||||
};
|
||||
|
||||
let verifier_settings = self.verifier_settings();
|
||||
let (private_provider_conf, private_enc_conf, private_tx_enabled) =
|
||||
self.private_provider_config()?;
|
||||
|
||||
let run_cmd = RunCmd {
|
||||
cache_config: cache_config,
|
||||
@@ -418,9 +415,6 @@ impl Configuration {
|
||||
experimental_rpcs,
|
||||
net_settings: self.network_settings()?,
|
||||
secretstore_conf: secretstore_conf,
|
||||
private_provider_conf: private_provider_conf,
|
||||
private_encryptor_conf: private_enc_conf,
|
||||
private_tx_enabled,
|
||||
name: self.args.arg_identity,
|
||||
custom_bootnodes: self.args.arg_bootnodes.is_some(),
|
||||
check_seal: !self.args.flag_no_seal_check,
|
||||
@@ -959,33 +953,6 @@ impl Configuration {
|
||||
Ok(conf)
|
||||
}
|
||||
|
||||
fn private_provider_config(&self) -> Result<(ProviderConfig, EncryptorConfig, bool), String> {
|
||||
let provider_conf = ProviderConfig {
|
||||
validator_accounts: to_addresses(&self.args.arg_private_validators)?,
|
||||
signer_account: self
|
||||
.args
|
||||
.arg_private_signer
|
||||
.clone()
|
||||
.and_then(|account| to_address(Some(account)).ok()),
|
||||
};
|
||||
|
||||
let encryptor_conf = EncryptorConfig {
|
||||
base_url: self.args.arg_private_sstore_url.clone(),
|
||||
threshold: self.args.arg_private_sstore_threshold.unwrap_or(0),
|
||||
key_server_account: self
|
||||
.args
|
||||
.arg_private_account
|
||||
.clone()
|
||||
.and_then(|account| to_address(Some(account)).ok()),
|
||||
};
|
||||
|
||||
Ok((
|
||||
provider_conf,
|
||||
encryptor_conf,
|
||||
self.args.flag_private_enabled,
|
||||
))
|
||||
}
|
||||
|
||||
fn snapshot_config(&self) -> Result<SnapshotConfiguration, String> {
|
||||
let conf = SnapshotConfiguration {
|
||||
no_periodic: self.args.flag_no_periodic_snapshot,
|
||||
@@ -1554,9 +1521,6 @@ mod tests {
|
||||
experimental_rpcs: false,
|
||||
net_settings: Default::default(),
|
||||
secretstore_conf: Default::default(),
|
||||
private_provider_conf: Default::default(),
|
||||
private_encryptor_conf: Default::default(),
|
||||
private_tx_enabled: false,
|
||||
name: "".into(),
|
||||
custom_bootnodes: false,
|
||||
fat_db: Default::default(),
|
||||
|
||||
@@ -49,7 +49,6 @@ extern crate ethcore_io as io;
|
||||
extern crate ethcore_logger;
|
||||
extern crate ethcore_miner as miner;
|
||||
extern crate ethcore_network as network;
|
||||
extern crate ethcore_private_tx;
|
||||
extern crate ethcore_service;
|
||||
extern crate ethcore_sync as sync;
|
||||
extern crate ethereum_types;
|
||||
|
||||
@@ -21,7 +21,7 @@ use sync::{self, ConnectionFilter, NetworkConfiguration, Params, SyncConfig};
|
||||
|
||||
pub use ethcore::client::ChainNotify;
|
||||
use ethcore_logger::Config as LogConfig;
|
||||
pub use sync::{EthSync, ManageNetwork, PrivateTxHandler, SyncProvider};
|
||||
pub use sync::{EthSync, ManageNetwork, SyncProvider};
|
||||
|
||||
pub type SyncModules = (
|
||||
Arc<dyn SyncProvider>,
|
||||
@@ -35,7 +35,6 @@ pub fn sync(
|
||||
network_config: NetworkConfiguration,
|
||||
chain: Arc<dyn BlockChainClient>,
|
||||
snapshot_service: Arc<dyn SnapshotService>,
|
||||
private_tx_handler: Option<Arc<dyn PrivateTxHandler>>,
|
||||
_log_settings: &LogConfig,
|
||||
connection_filter: Option<Arc<dyn ConnectionFilter>>,
|
||||
) -> Result<SyncModules, sync::Error> {
|
||||
@@ -44,7 +43,6 @@ pub fn sync(
|
||||
config,
|
||||
chain,
|
||||
snapshot_service,
|
||||
private_tx_handler,
|
||||
network_config,
|
||||
},
|
||||
connection_filter,
|
||||
|
||||
@@ -21,7 +21,6 @@ pub use parity_rpc::signer::SignerService;
|
||||
use account_utils::{self, AccountProvider};
|
||||
use ethcore::{client::Client, miner::Miner, snapshot::SnapshotService};
|
||||
use ethcore_logger::RotatingLogger;
|
||||
use ethcore_service::PrivateTxService;
|
||||
use fetch::Client as FetchClient;
|
||||
use jsonrpc_core::{self as core, MetaIoHandler};
|
||||
use miner::external::ExternalMiner;
|
||||
@@ -52,8 +51,6 @@ pub enum Api {
|
||||
Parity,
|
||||
/// Traces (Safe)
|
||||
Traces,
|
||||
/// Private transaction manager (Safe)
|
||||
Private,
|
||||
/// Parity PubSub - Generic Publish-Subscriber (Safety depends on other APIs exposed).
|
||||
ParityPubSub,
|
||||
/// Parity Accounts extensions (UNSAFE: Passwords, Side Effects (new account))
|
||||
@@ -82,7 +79,6 @@ impl FromStr for Api {
|
||||
"parity_pubsub" => Ok(ParityPubSub),
|
||||
"parity_set" => Ok(ParitySet),
|
||||
"personal" => Ok(Personal),
|
||||
"private" => Ok(Private),
|
||||
"pubsub" => Ok(EthPubSub),
|
||||
"secretstore" => Ok(SecretStore),
|
||||
"signer" => Ok(Signer),
|
||||
@@ -191,7 +187,6 @@ pub struct FullDependencies {
|
||||
pub sync: Arc<dyn SyncProvider>,
|
||||
pub net: Arc<dyn ManageNetwork>,
|
||||
pub accounts: Arc<AccountProvider>,
|
||||
pub private_tx_service: Option<Arc<PrivateTxService>>,
|
||||
pub miner: Arc<Miner>,
|
||||
pub external_miner: Arc<ExternalMiner>,
|
||||
pub logger: Arc<RotatingLogger>,
|
||||
@@ -385,12 +380,6 @@ impl FullDependencies {
|
||||
#[cfg(feature = "accounts")]
|
||||
handler.extend_with(SecretStoreClient::new(&self.accounts).to_delegate());
|
||||
}
|
||||
Api::Private => {
|
||||
handler.extend_with(
|
||||
PrivateClient::new(self.private_tx_service.as_ref().map(|p| p.provider()))
|
||||
.to_delegate(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -420,17 +409,11 @@ impl ApiSet {
|
||||
}
|
||||
|
||||
pub fn list_apis(&self) -> HashSet<Api> {
|
||||
let mut public_list: HashSet<Api> = [
|
||||
Api::Web3,
|
||||
Api::Net,
|
||||
Api::Eth,
|
||||
Api::EthPubSub,
|
||||
Api::Parity,
|
||||
Api::Private,
|
||||
]
|
||||
.iter()
|
||||
.cloned()
|
||||
.collect();
|
||||
let mut public_list: HashSet<Api> =
|
||||
[Api::Web3, Api::Net, Api::Eth, Api::EthPubSub, Api::Parity]
|
||||
.iter()
|
||||
.cloned()
|
||||
.collect();
|
||||
|
||||
match *self {
|
||||
ApiSet::List(ref apis) => apis.clone(),
|
||||
@@ -488,7 +471,6 @@ mod test {
|
||||
assert_eq!(Api::ParitySet, "parity_set".parse().unwrap());
|
||||
assert_eq!(Api::Traces, "traces".parse().unwrap());
|
||||
assert_eq!(Api::SecretStore, "secretstore".parse().unwrap());
|
||||
assert_eq!(Api::Private, "private".parse().unwrap());
|
||||
assert!("rp".parse::<Api>().is_err());
|
||||
}
|
||||
|
||||
@@ -516,7 +498,6 @@ mod test {
|
||||
Api::Parity,
|
||||
Api::ParityPubSub,
|
||||
Api::Traces,
|
||||
Api::Private,
|
||||
]
|
||||
.into_iter()
|
||||
.collect();
|
||||
@@ -534,7 +515,6 @@ mod test {
|
||||
Api::Parity,
|
||||
Api::ParityPubSub,
|
||||
Api::Traces,
|
||||
Api::Private,
|
||||
// semi-safe
|
||||
Api::ParityAccounts,
|
||||
]
|
||||
@@ -561,7 +541,6 @@ mod test {
|
||||
Api::ParitySet,
|
||||
Api::Signer,
|
||||
Api::Personal,
|
||||
Api::Private,
|
||||
Api::Debug,
|
||||
]
|
||||
.into_iter()
|
||||
@@ -587,7 +566,6 @@ mod test {
|
||||
Api::ParityAccounts,
|
||||
Api::ParitySet,
|
||||
Api::Signer,
|
||||
Api::Private,
|
||||
Api::Debug,
|
||||
]
|
||||
.into_iter()
|
||||
@@ -609,7 +587,6 @@ mod test {
|
||||
Api::Parity,
|
||||
Api::ParityPubSub,
|
||||
Api::Traces,
|
||||
Api::Private,
|
||||
]
|
||||
.into_iter()
|
||||
.collect()
|
||||
|
||||
@@ -33,7 +33,6 @@ use ethcore::{
|
||||
verification::queue::VerifierSettings,
|
||||
};
|
||||
use ethcore_logger::{Config as LogConfig, RotatingLogger};
|
||||
use ethcore_private_tx::{EncryptorConfig, ProviderConfig, SecretStoreEncryptor};
|
||||
use ethcore_service::ClientService;
|
||||
use helpers::{execute_upgrades, passwords_from_files, to_client_config};
|
||||
use informant::{FullNodeInformantData, Informant};
|
||||
@@ -56,7 +55,7 @@ use rpc;
|
||||
use rpc_apis;
|
||||
use secretstore;
|
||||
use signer;
|
||||
use sync::{self, PrivateTxHandler, SyncConfig};
|
||||
use sync::{self, SyncConfig};
|
||||
use user_defaults::UserDefaults;
|
||||
|
||||
// how often to take periodic snapshots.
|
||||
@@ -100,9 +99,6 @@ pub struct RunCmd {
|
||||
pub experimental_rpcs: bool,
|
||||
pub net_settings: NetworkSettings,
|
||||
pub secretstore_conf: secretstore::Configuration,
|
||||
pub private_provider_conf: ProviderConfig,
|
||||
pub private_encryptor_conf: EncryptorConfig,
|
||||
pub private_tx_enabled: bool,
|
||||
pub name: String,
|
||||
pub custom_bootnodes: bool,
|
||||
pub stratum: Option<stratum::Options>,
|
||||
@@ -348,8 +344,6 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<RunningClient
|
||||
.open(&client_path)
|
||||
.map_err(|e| format!("Failed to open database {:?}", e))?;
|
||||
|
||||
let private_tx_signer = account_utils::private_tx_signer(account_provider.clone(), &passwords)?;
|
||||
|
||||
// create client service.
|
||||
let service = ClientService::start(
|
||||
client_config,
|
||||
@@ -359,17 +353,6 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<RunningClient
|
||||
restoration_db_handler,
|
||||
&cmd.dirs.ipc_path(),
|
||||
miner.clone(),
|
||||
private_tx_signer.clone(),
|
||||
Box::new(
|
||||
SecretStoreEncryptor::new(
|
||||
cmd.private_encryptor_conf.clone(),
|
||||
fetch.clone(),
|
||||
private_tx_signer,
|
||||
)
|
||||
.map_err(|e| e.to_string())?,
|
||||
),
|
||||
cmd.private_provider_conf,
|
||||
cmd.private_encryptor_conf,
|
||||
)
|
||||
.map_err(|e| format!("Client service error: {:?}", e))?;
|
||||
|
||||
@@ -382,9 +365,6 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<RunningClient
|
||||
// Update miners block gas limit
|
||||
miner.update_transaction_queue_limits(*client.best_block_header().gas_limit());
|
||||
|
||||
// take handle to private transactions service
|
||||
let private_tx_service = service.private_tx_service();
|
||||
let private_tx_provider = private_tx_service.provider();
|
||||
let connection_filter = connection_filter_address.map(|a| {
|
||||
Arc::new(NodeFilter::new(
|
||||
Arc::downgrade(&client) as Weak<dyn BlockChainClient>,
|
||||
@@ -446,18 +426,12 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<RunningClient
|
||||
.map_err(|e| format!("Stratum start error: {:?}", e))?;
|
||||
}
|
||||
|
||||
let private_tx_sync: Option<Arc<dyn PrivateTxHandler>> = match cmd.private_tx_enabled {
|
||||
true => Some(private_tx_service.clone() as Arc<dyn PrivateTxHandler>),
|
||||
false => None,
|
||||
};
|
||||
|
||||
// create sync object
|
||||
let (sync_provider, manage_network, chain_notify, priority_tasks) = modules::sync(
|
||||
sync_config,
|
||||
net_conf.clone().into(),
|
||||
client.clone(),
|
||||
snapshot_service.clone(),
|
||||
private_tx_sync,
|
||||
&cmd.logger_config,
|
||||
connection_filter
|
||||
.clone()
|
||||
@@ -480,15 +454,6 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<RunningClient
|
||||
}
|
||||
}));
|
||||
|
||||
// provider not added to a notification center is effectively disabled
|
||||
// TODO [debris] refactor it later on
|
||||
if cmd.private_tx_enabled {
|
||||
service.add_notify(private_tx_provider.clone());
|
||||
// TODO [ToDr] PrivateTX should use separate notifications
|
||||
// re-using ChainNotify for this is a bit abusive.
|
||||
private_tx_provider.add_notify(chain_notify.clone());
|
||||
}
|
||||
|
||||
// start network
|
||||
if network_enabled {
|
||||
chain_notify.start();
|
||||
@@ -515,7 +480,6 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<RunningClient
|
||||
ws_address: cmd.ws_conf.address(),
|
||||
fetch: fetch.clone(),
|
||||
executor: runtime.executor(),
|
||||
private_tx_service: Some(private_tx_service.clone()),
|
||||
gas_price_percentile: cmd.gas_price_percentile,
|
||||
poll_lifetime: cmd.poll_lifetime,
|
||||
allow_missing_blocks: cmd.allow_missing_blocks,
|
||||
|
||||
@@ -38,7 +38,6 @@ use types::ids::BlockId;
|
||||
use cache::CacheConfig;
|
||||
use db;
|
||||
use dir::Directories;
|
||||
use ethcore_private_tx;
|
||||
use helpers::{execute_upgrades, to_client_config};
|
||||
use params::{fatdb_switch_to_bool, tracing_switch_to_bool, Pruning, SpecType, Switch};
|
||||
use user_defaults::UserDefaults;
|
||||
@@ -239,10 +238,6 @@ impl SnapshotCommand {
|
||||
// TODO [ToDr] don't use test miner here
|
||||
// (actually don't require miner at all)
|
||||
Arc::new(Miner::new_for_tests(&spec, None)),
|
||||
Arc::new(ethcore_private_tx::DummySigner),
|
||||
Box::new(ethcore_private_tx::NoopEncryptor),
|
||||
Default::default(),
|
||||
Default::default(),
|
||||
)
|
||||
.map_err(|e| format!("Client service error: {:?}", e))?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user