Remove public node settings from cli (#8758)
* Remove public node related settings * Fix tests * Unwrap accounts provider in all rpc apis * Unwrap AccountProvider in all cli places * Fix rpc tests
This commit is contained in:
parent
0ebcc200c3
commit
79eb8f7ace
@ -240,10 +240,6 @@ usage! {
|
|||||||
{
|
{
|
||||||
// Global flags and arguments
|
// Global flags and arguments
|
||||||
["Operating Options"]
|
["Operating Options"]
|
||||||
FLAG flag_public_node: (bool) = false, or |c: &Config| c.parity.as_ref()?.public_node.clone(),
|
|
||||||
"--public-node",
|
|
||||||
"Start Parity as a public web server. Account storage and transaction signing will be delegated to the UI.",
|
|
||||||
|
|
||||||
FLAG flag_no_download: (bool) = false, or |c: &Config| c.parity.as_ref()?.no_download.clone(),
|
FLAG flag_no_download: (bool) = false, or |c: &Config| c.parity.as_ref()?.no_download.clone(),
|
||||||
"--no-download",
|
"--no-download",
|
||||||
"Normally new releases will be downloaded ready for updating. This disables it. Not recommended.",
|
"Normally new releases will be downloaded ready for updating. This disables it. Not recommended.",
|
||||||
@ -948,6 +944,10 @@ usage! {
|
|||||||
"--rpc",
|
"--rpc",
|
||||||
"Does nothing; JSON-RPC is on by default now.",
|
"Does nothing; JSON-RPC is on by default now.",
|
||||||
|
|
||||||
|
FLAG flag_public_node: (bool) = false, or |_| None,
|
||||||
|
"--public-node",
|
||||||
|
"Does nothing; Public node is removed from Parity.",
|
||||||
|
|
||||||
ARG arg_dapps_port: (Option<u16>) = None, or |c: &Config| c.dapps.as_ref()?.port.clone(),
|
ARG arg_dapps_port: (Option<u16>) = None, or |c: &Config| c.dapps.as_ref()?.port.clone(),
|
||||||
"--dapps-port=[PORT]",
|
"--dapps-port=[PORT]",
|
||||||
"Dapps server is merged with RPC server. Use --jsonrpc-port.",
|
"Dapps server is merged with RPC server. Use --jsonrpc-port.",
|
||||||
@ -1070,7 +1070,6 @@ struct Operating {
|
|||||||
auto_update_delay: Option<u16>,
|
auto_update_delay: Option<u16>,
|
||||||
auto_update_check_frequency: Option<u16>,
|
auto_update_check_frequency: Option<u16>,
|
||||||
release_track: Option<String>,
|
release_track: Option<String>,
|
||||||
public_node: Option<bool>,
|
|
||||||
no_download: Option<bool>,
|
no_download: Option<bool>,
|
||||||
no_consensus: Option<bool>,
|
no_consensus: Option<bool>,
|
||||||
chain: Option<String>,
|
chain: Option<String>,
|
||||||
@ -1081,6 +1080,9 @@ struct Operating {
|
|||||||
light: Option<bool>,
|
light: Option<bool>,
|
||||||
no_persistent_txqueue: Option<bool>,
|
no_persistent_txqueue: Option<bool>,
|
||||||
no_hardcoded_sync: Option<bool>,
|
no_hardcoded_sync: Option<bool>,
|
||||||
|
|
||||||
|
#[serde(rename="public_node")]
|
||||||
|
_legacy_public_node: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug, PartialEq, Deserialize)]
|
#[derive(Default, Debug, PartialEq, Deserialize)]
|
||||||
@ -1797,7 +1799,6 @@ mod tests {
|
|||||||
auto_update_delay: None,
|
auto_update_delay: None,
|
||||||
auto_update_check_frequency: None,
|
auto_update_check_frequency: None,
|
||||||
release_track: None,
|
release_track: None,
|
||||||
public_node: None,
|
|
||||||
no_download: None,
|
no_download: None,
|
||||||
no_consensus: None,
|
no_consensus: None,
|
||||||
chain: Some("./chain.json".into()),
|
chain: Some("./chain.json".into()),
|
||||||
@ -1808,6 +1809,7 @@ mod tests {
|
|||||||
light: None,
|
light: None,
|
||||||
no_hardcoded_sync: None,
|
no_hardcoded_sync: None,
|
||||||
no_persistent_txqueue: None,
|
no_persistent_txqueue: None,
|
||||||
|
_legacy_public_node: None,
|
||||||
}),
|
}),
|
||||||
account: Some(Account {
|
account: Some(Account {
|
||||||
unlock: Some(vec!["0x1".into(), "0x2".into(), "0x3".into()]),
|
unlock: Some(vec!["0x1".into(), "0x2".into(), "0x3".into()]),
|
||||||
|
@ -35,7 +35,6 @@ use ethcore::verification::queue::VerifierSettings;
|
|||||||
use miner::pool;
|
use miner::pool;
|
||||||
|
|
||||||
use rpc::{IpcConfiguration, HttpConfiguration, WsConfiguration, UiConfiguration};
|
use rpc::{IpcConfiguration, HttpConfiguration, WsConfiguration, UiConfiguration};
|
||||||
use rpc_apis::ApiSet;
|
|
||||||
use parity_rpc::NetworkSettings;
|
use parity_rpc::NetworkSettings;
|
||||||
use cache::CacheConfig;
|
use cache::CacheConfig;
|
||||||
use helpers::{to_duration, to_mode, to_block_id, to_u256, to_pending_set, to_price, geth_ipc_path, parity_ipc_path, to_bootnodes, to_addresses, to_address, to_queue_strategy, to_queue_penalization, passwords_from_files};
|
use helpers::{to_duration, to_mode, to_block_id, to_u256, to_pending_set, to_price, geth_ipc_path, parity_ipc_path, to_bootnodes, to_addresses, to_address, to_queue_strategy, to_queue_penalization, passwords_from_files};
|
||||||
@ -138,7 +137,6 @@ impl Configuration {
|
|||||||
let fat_db = self.args.arg_fat_db.parse()?;
|
let fat_db = self.args.arg_fat_db.parse()?;
|
||||||
let compaction = self.args.arg_db_compaction.parse()?;
|
let compaction = self.args.arg_db_compaction.parse()?;
|
||||||
let wal = !self.args.flag_fast_and_loose;
|
let wal = !self.args.flag_fast_and_loose;
|
||||||
let public_node = self.args.flag_public_node;
|
|
||||||
let warp_sync = !self.args.flag_no_warp;
|
let warp_sync = !self.args.flag_no_warp;
|
||||||
let geth_compatibility = self.args.flag_geth;
|
let geth_compatibility = self.args.flag_geth;
|
||||||
let dapps_conf = self.dapps_config();
|
let dapps_conf = self.dapps_config();
|
||||||
@ -379,7 +377,6 @@ impl Configuration {
|
|||||||
vm_type: vm_type,
|
vm_type: vm_type,
|
||||||
warp_sync: warp_sync,
|
warp_sync: warp_sync,
|
||||||
warp_barrier: self.args.arg_warp_barrier,
|
warp_barrier: self.args.arg_warp_barrier,
|
||||||
public_node: public_node,
|
|
||||||
geth_compatibility: geth_compatibility,
|
geth_compatibility: geth_compatibility,
|
||||||
net_settings: self.network_settings()?,
|
net_settings: self.network_settings()?,
|
||||||
dapps_conf: dapps_conf,
|
dapps_conf: dapps_conf,
|
||||||
@ -914,10 +911,7 @@ impl Configuration {
|
|||||||
enabled: self.rpc_enabled(),
|
enabled: self.rpc_enabled(),
|
||||||
interface: self.rpc_interface(),
|
interface: self.rpc_interface(),
|
||||||
port: self.args.arg_ports_shift + self.args.arg_rpcport.unwrap_or(self.args.arg_jsonrpc_port),
|
port: self.args.arg_ports_shift + self.args.arg_rpcport.unwrap_or(self.args.arg_jsonrpc_port),
|
||||||
apis: match self.args.flag_public_node {
|
apis: self.rpc_apis().parse()?,
|
||||||
false => self.rpc_apis().parse()?,
|
|
||||||
true => self.rpc_apis().parse::<ApiSet>()?.retain(ApiSet::PublicContext),
|
|
||||||
},
|
|
||||||
hosts: self.rpc_hosts(),
|
hosts: self.rpc_hosts(),
|
||||||
cors: self.rpc_cors(),
|
cors: self.rpc_cors(),
|
||||||
server_threads: match self.args.arg_jsonrpc_server_threads {
|
server_threads: match self.args.arg_jsonrpc_server_threads {
|
||||||
@ -935,10 +929,8 @@ impl Configuration {
|
|||||||
let http = self.http_config()?;
|
let http = self.http_config()?;
|
||||||
|
|
||||||
let support_token_api =
|
let support_token_api =
|
||||||
// never enabled for public node
|
// enabled when not unlocking
|
||||||
!self.args.flag_public_node
|
self.args.arg_unlock.is_none();
|
||||||
// enabled when not unlocking unless the ui is forced
|
|
||||||
&& (self.args.arg_unlock.is_none() || ui.enabled);
|
|
||||||
|
|
||||||
let conf = WsConfiguration {
|
let conf = WsConfiguration {
|
||||||
enabled: self.ws_enabled(),
|
enabled: self.ws_enabled(),
|
||||||
@ -1263,6 +1255,7 @@ mod tests {
|
|||||||
use params::SpecType;
|
use params::SpecType;
|
||||||
use presale::ImportWallet;
|
use presale::ImportWallet;
|
||||||
use rpc::{WsConfiguration, UiConfiguration};
|
use rpc::{WsConfiguration, UiConfiguration};
|
||||||
|
use rpc_apis::ApiSet;
|
||||||
use run::RunCmd;
|
use run::RunCmd;
|
||||||
|
|
||||||
use network::{AllowIP, IpFilter};
|
use network::{AllowIP, IpFilter};
|
||||||
@ -1499,7 +1492,6 @@ mod tests {
|
|||||||
ipc_conf: Default::default(),
|
ipc_conf: Default::default(),
|
||||||
net_conf: default_network_config(),
|
net_conf: default_network_config(),
|
||||||
network_id: None,
|
network_id: None,
|
||||||
public_node: false,
|
|
||||||
warp_sync: true,
|
warp_sync: true,
|
||||||
warp_barrier: None,
|
warp_barrier: None,
|
||||||
acc_conf: Default::default(),
|
acc_conf: Default::default(),
|
||||||
|
@ -116,8 +116,6 @@ pub enum ApiSet {
|
|||||||
SafeContext,
|
SafeContext,
|
||||||
// Unsafe context (like jsonrpc over http)
|
// Unsafe context (like jsonrpc over http)
|
||||||
UnsafeContext,
|
UnsafeContext,
|
||||||
// Public context (like public jsonrpc over http)
|
|
||||||
PublicContext,
|
|
||||||
// All possible APIs
|
// All possible APIs
|
||||||
All,
|
All,
|
||||||
// Local "unsafe" context and accounts access
|
// Local "unsafe" context and accounts access
|
||||||
@ -219,7 +217,7 @@ pub struct FullDependencies {
|
|||||||
pub snapshot: Arc<SnapshotService>,
|
pub snapshot: Arc<SnapshotService>,
|
||||||
pub sync: Arc<SyncProvider>,
|
pub sync: Arc<SyncProvider>,
|
||||||
pub net: Arc<ManageNetwork>,
|
pub net: Arc<ManageNetwork>,
|
||||||
pub secret_store: Option<Arc<AccountProvider>>,
|
pub secret_store: Arc<AccountProvider>,
|
||||||
pub private_tx_service: Option<Arc<PrivateTxService>>,
|
pub private_tx_service: Option<Arc<PrivateTxService>>,
|
||||||
pub miner: Arc<Miner>,
|
pub miner: Arc<Miner>,
|
||||||
pub external_miner: Arc<ExternalMiner>,
|
pub external_miner: Arc<ExternalMiner>,
|
||||||
@ -316,7 +314,7 @@ impl FullDependencies {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
Api::Personal => {
|
Api::Personal => {
|
||||||
handler.extend_with(PersonalClient::new(self.secret_store.clone(), dispatcher.clone(), self.geth_compatibility).to_delegate());
|
handler.extend_with(PersonalClient::new(&self.secret_store, dispatcher.clone(), self.geth_compatibility).to_delegate());
|
||||||
},
|
},
|
||||||
Api::Signer => {
|
Api::Signer => {
|
||||||
handler.extend_with(SignerClient::new(&self.secret_store, dispatcher.clone(), &self.signer_service, self.remote.clone()).to_delegate());
|
handler.extend_with(SignerClient::new(&self.secret_store, dispatcher.clone(), &self.signer_service, self.remote.clone()).to_delegate());
|
||||||
@ -475,7 +473,7 @@ impl<C: LightChainClient + 'static> LightDependencies<C> {
|
|||||||
{
|
{
|
||||||
let deps = &$deps;
|
let deps = &$deps;
|
||||||
let dispatcher = dispatcher.clone();
|
let dispatcher = dispatcher.clone();
|
||||||
let secret_store = Some(deps.secret_store.clone());
|
let secret_store = deps.secret_store.clone();
|
||||||
if deps.signer_service.is_enabled() {
|
if deps.signer_service.is_enabled() {
|
||||||
$handler.extend_with($namespace::to_delegate(
|
$handler.extend_with($namespace::to_delegate(
|
||||||
SigningQueueClient::new(&deps.signer_service, dispatcher, deps.remote.clone(), &secret_store)
|
SigningQueueClient::new(&deps.signer_service, dispatcher, deps.remote.clone(), &secret_store)
|
||||||
@ -533,12 +531,10 @@ impl<C: LightChainClient + 'static> LightDependencies<C> {
|
|||||||
handler.extend_with(EthPubSub::to_delegate(client));
|
handler.extend_with(EthPubSub::to_delegate(client));
|
||||||
},
|
},
|
||||||
Api::Personal => {
|
Api::Personal => {
|
||||||
let secret_store = Some(self.secret_store.clone());
|
handler.extend_with(PersonalClient::new(&self.secret_store, dispatcher.clone(), self.geth_compatibility).to_delegate());
|
||||||
handler.extend_with(PersonalClient::new(secret_store, dispatcher.clone(), self.geth_compatibility).to_delegate());
|
|
||||||
},
|
},
|
||||||
Api::Signer => {
|
Api::Signer => {
|
||||||
let secret_store = Some(self.secret_store.clone());
|
handler.extend_with(SignerClient::new(&self.secret_store, dispatcher.clone(), &self.signer_service, self.remote.clone()).to_delegate());
|
||||||
handler.extend_with(SignerClient::new(&secret_store, dispatcher.clone(), &self.signer_service, self.remote.clone()).to_delegate());
|
|
||||||
},
|
},
|
||||||
Api::Parity => {
|
Api::Parity => {
|
||||||
let signer = match self.signer_service.is_enabled() {
|
let signer = match self.signer_service.is_enabled() {
|
||||||
@ -571,8 +567,7 @@ impl<C: LightChainClient + 'static> LightDependencies<C> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
Api::ParityAccounts => {
|
Api::ParityAccounts => {
|
||||||
let secret_store = Some(self.secret_store.clone());
|
handler.extend_with(ParityAccountsClient::new(&self.secret_store).to_delegate());
|
||||||
handler.extend_with(ParityAccountsClient::new(&secret_store).to_delegate());
|
|
||||||
},
|
},
|
||||||
Api::ParitySet => {
|
Api::ParitySet => {
|
||||||
handler.extend_with(light::ParitySetClient::new(
|
handler.extend_with(light::ParitySetClient::new(
|
||||||
@ -590,8 +585,7 @@ impl<C: LightChainClient + 'static> LightDependencies<C> {
|
|||||||
handler.extend_with(RpcClient::new(modules).to_delegate());
|
handler.extend_with(RpcClient::new(modules).to_delegate());
|
||||||
},
|
},
|
||||||
Api::SecretStore => {
|
Api::SecretStore => {
|
||||||
let secret_store = Some(self.secret_store.clone());
|
handler.extend_with(SecretStoreClient::new(&self.secret_store).to_delegate());
|
||||||
handler.extend_with(SecretStoreClient::new(&secret_store).to_delegate());
|
|
||||||
},
|
},
|
||||||
Api::Whisper => {
|
Api::Whisper => {
|
||||||
if let Some(ref whisper_rpc) = self.whisper_rpc {
|
if let Some(ref whisper_rpc) = self.whisper_rpc {
|
||||||
@ -637,7 +631,7 @@ impl ApiSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn list_apis(&self) -> HashSet<Api> {
|
pub fn list_apis(&self) -> HashSet<Api> {
|
||||||
let mut public_list = [
|
let mut public_list: HashSet<Api> = [
|
||||||
Api::Web3,
|
Api::Web3,
|
||||||
Api::Net,
|
Api::Net,
|
||||||
Api::Eth,
|
Api::Eth,
|
||||||
@ -651,7 +645,6 @@ impl ApiSet {
|
|||||||
|
|
||||||
match *self {
|
match *self {
|
||||||
ApiSet::List(ref apis) => apis.clone(),
|
ApiSet::List(ref apis) => apis.clone(),
|
||||||
ApiSet::PublicContext => public_list,
|
|
||||||
ApiSet::UnsafeContext => {
|
ApiSet::UnsafeContext => {
|
||||||
public_list.insert(Api::Traces);
|
public_list.insert(Api::Traces);
|
||||||
public_list.insert(Api::ParityPubSub);
|
public_list.insert(Api::ParityPubSub);
|
||||||
|
@ -98,7 +98,6 @@ pub struct RunCmd {
|
|||||||
pub network_id: Option<u64>,
|
pub network_id: Option<u64>,
|
||||||
pub warp_sync: bool,
|
pub warp_sync: bool,
|
||||||
pub warp_barrier: Option<u64>,
|
pub warp_barrier: Option<u64>,
|
||||||
pub public_node: bool,
|
|
||||||
pub acc_conf: AccountsConfig,
|
pub acc_conf: AccountsConfig,
|
||||||
pub gas_pricer_conf: GasPricerConfig,
|
pub gas_pricer_conf: GasPricerConfig,
|
||||||
pub miner_extras: MinerExtras,
|
pub miner_extras: MinerExtras,
|
||||||
@ -721,11 +720,7 @@ fn execute_impl<Cr, Rr>(cmd: RunCmd, logger: Arc<RotatingLogger>, on_client_rq:
|
|||||||
|
|
||||||
// set up dependencies for rpc servers
|
// set up dependencies for rpc servers
|
||||||
let rpc_stats = Arc::new(informant::RpcStats::default());
|
let rpc_stats = Arc::new(informant::RpcStats::default());
|
||||||
let secret_store = match cmd.public_node {
|
let secret_store = account_provider.clone();
|
||||||
true => None,
|
|
||||||
false => Some(account_provider.clone())
|
|
||||||
};
|
|
||||||
|
|
||||||
let signer_service = Arc::new(signer::new_service(&cmd.ws_conf, &cmd.logger_config));
|
let signer_service = Arc::new(signer::new_service(&cmd.ws_conf, &cmd.logger_config));
|
||||||
|
|
||||||
// the dapps server
|
// the dapps server
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
|
|
||||||
// This file is part of Parity.
|
|
||||||
|
|
||||||
// Parity is free software: you can redistribute it and/or modify
|
|
||||||
// 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.
|
|
||||||
|
|
||||||
// Parity is distributed in the hope that it will be useful,
|
|
||||||
// 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
|
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
use std::sync::Arc;
|
|
||||||
use ethcore::account_provider::AccountProvider;
|
|
||||||
use jsonrpc_core::Error;
|
|
||||||
use v1::helpers::errors;
|
|
||||||
|
|
||||||
pub fn unwrap_provider(provider: &Option<Arc<AccountProvider>>) -> Result<Arc<AccountProvider>, Error> {
|
|
||||||
match *provider {
|
|
||||||
Some(ref arc) => Ok(arc.clone()),
|
|
||||||
None => Err(errors::public_unsupported(None)),
|
|
||||||
}
|
|
||||||
}
|
|
@ -68,14 +68,6 @@ pub fn light_unimplemented(details: Option<String>) -> Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn public_unsupported(details: Option<String>) -> Error {
|
|
||||||
Error {
|
|
||||||
code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
|
|
||||||
message: "Method disallowed when running parity as a public node.".into(),
|
|
||||||
data: details.map(Value::String),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn unsupported<T: Into<String>>(msg: T, details: Option<T>) -> Error {
|
pub fn unsupported<T: Into<String>>(msg: T, details: Option<T>) -> Error {
|
||||||
Error {
|
Error {
|
||||||
code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
|
code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub mod errors;
|
pub mod errors;
|
||||||
|
|
||||||
pub mod accounts;
|
|
||||||
pub mod block_import;
|
pub mod block_import;
|
||||||
pub mod dapps;
|
pub mod dapps;
|
||||||
pub mod dispatch;
|
pub mod dispatch;
|
||||||
|
@ -45,7 +45,6 @@ use jsonrpc_macros::Trailing;
|
|||||||
use v1::helpers::{errors, limit_logs, fake_sign};
|
use v1::helpers::{errors, limit_logs, fake_sign};
|
||||||
use v1::helpers::dispatch::{FullDispatcher, default_gas_price};
|
use v1::helpers::dispatch::{FullDispatcher, default_gas_price};
|
||||||
use v1::helpers::block_import::is_major_importing;
|
use v1::helpers::block_import::is_major_importing;
|
||||||
use v1::helpers::accounts::unwrap_provider;
|
|
||||||
use v1::traits::Eth;
|
use v1::traits::Eth;
|
||||||
use v1::types::{
|
use v1::types::{
|
||||||
RichBlock, Block, BlockTransactions, BlockNumber, Bytes, SyncStatus, SyncInfo,
|
RichBlock, Block, BlockTransactions, BlockNumber, Bytes, SyncStatus, SyncInfo,
|
||||||
@ -100,7 +99,7 @@ pub struct EthClient<C, SN: ?Sized, S: ?Sized, M, EM> where
|
|||||||
client: Arc<C>,
|
client: Arc<C>,
|
||||||
snapshot: Arc<SN>,
|
snapshot: Arc<SN>,
|
||||||
sync: Arc<S>,
|
sync: Arc<S>,
|
||||||
accounts: Option<Arc<AccountProvider>>,
|
accounts: Arc<AccountProvider>,
|
||||||
miner: Arc<M>,
|
miner: Arc<M>,
|
||||||
external_miner: Arc<EM>,
|
external_miner: Arc<EM>,
|
||||||
seed_compute: Mutex<SeedHashCompute>,
|
seed_compute: Mutex<SeedHashCompute>,
|
||||||
@ -153,7 +152,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> EthClient<C, SN, S
|
|||||||
client: &Arc<C>,
|
client: &Arc<C>,
|
||||||
snapshot: &Arc<SN>,
|
snapshot: &Arc<SN>,
|
||||||
sync: &Arc<S>,
|
sync: &Arc<S>,
|
||||||
accounts: &Option<Arc<AccountProvider>>,
|
accounts: &Arc<AccountProvider>,
|
||||||
miner: &Arc<M>,
|
miner: &Arc<M>,
|
||||||
em: &Arc<EM>,
|
em: &Arc<EM>,
|
||||||
options: EthClientOptions
|
options: EthClientOptions
|
||||||
@ -174,7 +173,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> EthClient<C, SN, S
|
|||||||
/// Attempt to get the `Arc<AccountProvider>`, errors if provider was not
|
/// Attempt to get the `Arc<AccountProvider>`, errors if provider was not
|
||||||
/// set.
|
/// set.
|
||||||
fn account_provider(&self) -> Result<Arc<AccountProvider>> {
|
fn account_provider(&self) -> Result<Arc<AccountProvider>> {
|
||||||
unwrap_provider(&self.accounts)
|
Ok(self.accounts.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rich_block(&self, id: BlockNumberOrId, include_txs: bool) -> Result<Option<RichBlock>> {
|
fn rich_block(&self, id: BlockNumberOrId, include_txs: bool) -> Result<Option<RichBlock>> {
|
||||||
|
@ -40,7 +40,6 @@ use jsonrpc_core::{BoxFuture, Result};
|
|||||||
use jsonrpc_core::futures::{future, Future};
|
use jsonrpc_core::futures::{future, Future};
|
||||||
use jsonrpc_macros::Trailing;
|
use jsonrpc_macros::Trailing;
|
||||||
use v1::helpers::{self, errors, fake_sign, ipfs, SigningQueue, SignerService, NetworkSettings};
|
use v1::helpers::{self, errors, fake_sign, ipfs, SigningQueue, SignerService, NetworkSettings};
|
||||||
use v1::helpers::accounts::unwrap_provider;
|
|
||||||
use v1::metadata::Metadata;
|
use v1::metadata::Metadata;
|
||||||
use v1::traits::Parity;
|
use v1::traits::Parity;
|
||||||
use v1::types::{
|
use v1::types::{
|
||||||
@ -62,7 +61,7 @@ pub struct ParityClient<C, M, U> {
|
|||||||
sync: Arc<SyncProvider>,
|
sync: Arc<SyncProvider>,
|
||||||
net: Arc<ManageNetwork>,
|
net: Arc<ManageNetwork>,
|
||||||
health: NodeHealth,
|
health: NodeHealth,
|
||||||
accounts: Option<Arc<AccountProvider>>,
|
accounts: Arc<AccountProvider>,
|
||||||
logger: Arc<RotatingLogger>,
|
logger: Arc<RotatingLogger>,
|
||||||
settings: Arc<NetworkSettings>,
|
settings: Arc<NetworkSettings>,
|
||||||
signer: Option<Arc<SignerService>>,
|
signer: Option<Arc<SignerService>>,
|
||||||
@ -82,7 +81,7 @@ impl<C, M, U> ParityClient<C, M, U> where
|
|||||||
updater: Arc<U>,
|
updater: Arc<U>,
|
||||||
net: Arc<ManageNetwork>,
|
net: Arc<ManageNetwork>,
|
||||||
health: NodeHealth,
|
health: NodeHealth,
|
||||||
accounts: Option<Arc<AccountProvider>>,
|
accounts: Arc<AccountProvider>,
|
||||||
logger: Arc<RotatingLogger>,
|
logger: Arc<RotatingLogger>,
|
||||||
settings: Arc<NetworkSettings>,
|
settings: Arc<NetworkSettings>,
|
||||||
signer: Option<Arc<SignerService>>,
|
signer: Option<Arc<SignerService>>,
|
||||||
@ -110,7 +109,7 @@ impl<C, M, U> ParityClient<C, M, U> where
|
|||||||
/// Attempt to get the `Arc<AccountProvider>`, errors if provider was not
|
/// Attempt to get the `Arc<AccountProvider>`, errors if provider was not
|
||||||
/// set.
|
/// set.
|
||||||
fn account_provider(&self) -> Result<Arc<AccountProvider>> {
|
fn account_provider(&self) -> Result<Arc<AccountProvider>> {
|
||||||
unwrap_provider(&self.accounts)
|
Ok(self.accounts.clone())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,11 +348,6 @@ impl<C, M, U, S> Parity for ParityClient<C, M, U> where
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn local_transactions(&self) -> Result<BTreeMap<H256, LocalTransactionStatus>> {
|
fn local_transactions(&self) -> Result<BTreeMap<H256, LocalTransactionStatus>> {
|
||||||
// Return nothing if accounts are disabled (running as public node)
|
|
||||||
if self.accounts.is_none() {
|
|
||||||
return Ok(BTreeMap::new());
|
|
||||||
}
|
|
||||||
|
|
||||||
let transactions = self.miner.local_transactions();
|
let transactions = self.miner.local_transactions();
|
||||||
let block_number = self.client.chain_info().best_block_number;
|
let block_number = self.client.chain_info().best_block_number;
|
||||||
Ok(transactions
|
Ok(transactions
|
||||||
@ -418,13 +412,8 @@ impl<C, M, U, S> Parity for ParityClient<C, M, U> where
|
|||||||
fn node_kind(&self) -> Result<::v1::types::NodeKind> {
|
fn node_kind(&self) -> Result<::v1::types::NodeKind> {
|
||||||
use ::v1::types::{NodeKind, Availability, Capability};
|
use ::v1::types::{NodeKind, Availability, Capability};
|
||||||
|
|
||||||
let availability = match self.accounts {
|
|
||||||
Some(_) => Availability::Personal,
|
|
||||||
None => Availability::Public
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(NodeKind {
|
Ok(NodeKind {
|
||||||
availability: availability,
|
availability: Availability::Personal,
|
||||||
capability: Capability::Full,
|
capability: Capability::Full,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -25,18 +25,17 @@ use ethcore::account_provider::AccountProvider;
|
|||||||
|
|
||||||
use jsonrpc_core::Result;
|
use jsonrpc_core::Result;
|
||||||
use v1::helpers::errors;
|
use v1::helpers::errors;
|
||||||
use v1::helpers::accounts::unwrap_provider;
|
|
||||||
use v1::traits::ParityAccounts;
|
use v1::traits::ParityAccounts;
|
||||||
use v1::types::{H160 as RpcH160, H256 as RpcH256, H520 as RpcH520, DappId, Derive, DeriveHierarchical, DeriveHash, ExtAccountInfo};
|
use v1::types::{H160 as RpcH160, H256 as RpcH256, H520 as RpcH520, DappId, Derive, DeriveHierarchical, DeriveHash, ExtAccountInfo};
|
||||||
|
|
||||||
/// Account management (personal) rpc implementation.
|
/// Account management (personal) rpc implementation.
|
||||||
pub struct ParityAccountsClient {
|
pub struct ParityAccountsClient {
|
||||||
accounts: Option<Arc<AccountProvider>>,
|
accounts: Arc<AccountProvider>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ParityAccountsClient {
|
impl ParityAccountsClient {
|
||||||
/// Creates new PersonalClient
|
/// Creates new PersonalClient
|
||||||
pub fn new(store: &Option<Arc<AccountProvider>>) -> Self {
|
pub fn new(store: &Arc<AccountProvider>) -> Self {
|
||||||
ParityAccountsClient {
|
ParityAccountsClient {
|
||||||
accounts: store.clone(),
|
accounts: store.clone(),
|
||||||
}
|
}
|
||||||
@ -45,7 +44,7 @@ impl ParityAccountsClient {
|
|||||||
/// Attempt to get the `Arc<AccountProvider>`, errors if provider was not
|
/// Attempt to get the `Arc<AccountProvider>`, errors if provider was not
|
||||||
/// set.
|
/// set.
|
||||||
fn account_provider(&self) -> Result<Arc<AccountProvider>> {
|
fn account_provider(&self) -> Result<Arc<AccountProvider>> {
|
||||||
unwrap_provider(&self.accounts)
|
Ok(self.accounts.clone())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ use jsonrpc_core::{BoxFuture, Result};
|
|||||||
use jsonrpc_core::futures::{future, Future};
|
use jsonrpc_core::futures::{future, Future};
|
||||||
use v1::helpers::errors;
|
use v1::helpers::errors;
|
||||||
use v1::helpers::dispatch::{self, eth_data_hash, Dispatcher, SignWith};
|
use v1::helpers::dispatch::{self, eth_data_hash, Dispatcher, SignWith};
|
||||||
use v1::helpers::accounts::unwrap_provider;
|
|
||||||
use v1::traits::Personal;
|
use v1::traits::Personal;
|
||||||
use v1::types::{
|
use v1::types::{
|
||||||
H160 as RpcH160, H256 as RpcH256, H520 as RpcH520, U128 as RpcU128,
|
H160 as RpcH160, H256 as RpcH256, H520 as RpcH520, U128 as RpcU128,
|
||||||
@ -42,23 +41,23 @@ use v1::metadata::Metadata;
|
|||||||
|
|
||||||
/// Account management (personal) rpc implementation.
|
/// Account management (personal) rpc implementation.
|
||||||
pub struct PersonalClient<D: Dispatcher> {
|
pub struct PersonalClient<D: Dispatcher> {
|
||||||
accounts: Option<Arc<AccountProvider>>,
|
accounts: Arc<AccountProvider>,
|
||||||
dispatcher: D,
|
dispatcher: D,
|
||||||
allow_perm_unlock: bool,
|
allow_perm_unlock: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<D: Dispatcher> PersonalClient<D> {
|
impl<D: Dispatcher> PersonalClient<D> {
|
||||||
/// Creates new PersonalClient
|
/// Creates new PersonalClient
|
||||||
pub fn new(accounts: Option<Arc<AccountProvider>>, dispatcher: D, allow_perm_unlock: bool) -> Self {
|
pub fn new(accounts: &Arc<AccountProvider>, dispatcher: D, allow_perm_unlock: bool) -> Self {
|
||||||
PersonalClient {
|
PersonalClient {
|
||||||
accounts,
|
accounts: accounts.clone(),
|
||||||
dispatcher,
|
dispatcher,
|
||||||
allow_perm_unlock,
|
allow_perm_unlock,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn account_provider(&self) -> Result<Arc<AccountProvider>> {
|
fn account_provider(&self) -> Result<Arc<AccountProvider>> {
|
||||||
unwrap_provider(&self.accounts)
|
Ok(self.accounts.clone())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ impl PrivateClient {
|
|||||||
fn unwrap_manager(&self) -> Result<&PrivateTransactionManager, Error> {
|
fn unwrap_manager(&self) -> Result<&PrivateTransactionManager, Error> {
|
||||||
match self.private {
|
match self.private {
|
||||||
Some(ref arc) => Ok(&**arc),
|
Some(ref arc) => Ok(&**arc),
|
||||||
None => Err(errors::public_unsupported(None)),
|
None => Err(errors::light_unimplemented(None)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,4 +119,3 @@ impl Private for PrivateClient {
|
|||||||
Ok(key.into())
|
Ok(key.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ use ethcore::account_provider::AccountProvider;
|
|||||||
|
|
||||||
use jsonrpc_core::Result;
|
use jsonrpc_core::Result;
|
||||||
use v1::helpers::errors;
|
use v1::helpers::errors;
|
||||||
use v1::helpers::accounts::unwrap_provider;
|
|
||||||
use v1::helpers::secretstore::{generate_document_key, encrypt_document,
|
use v1::helpers::secretstore::{generate_document_key, encrypt_document,
|
||||||
decrypt_document, decrypt_document_with_shadow, ordered_servers_keccak};
|
decrypt_document, decrypt_document_with_shadow, ordered_servers_keccak};
|
||||||
use v1::traits::SecretStore;
|
use v1::traits::SecretStore;
|
||||||
@ -33,12 +32,12 @@ use v1::types::{H160, H256, H512, Bytes, EncryptedDocumentKey};
|
|||||||
|
|
||||||
/// Parity implementation.
|
/// Parity implementation.
|
||||||
pub struct SecretStoreClient {
|
pub struct SecretStoreClient {
|
||||||
accounts: Option<Arc<AccountProvider>>,
|
accounts: Arc<AccountProvider>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SecretStoreClient {
|
impl SecretStoreClient {
|
||||||
/// Creates new SecretStoreClient
|
/// Creates new SecretStoreClient
|
||||||
pub fn new(store: &Option<Arc<AccountProvider>>) -> Self {
|
pub fn new(store: &Arc<AccountProvider>) -> Self {
|
||||||
SecretStoreClient {
|
SecretStoreClient {
|
||||||
accounts: store.clone(),
|
accounts: store.clone(),
|
||||||
}
|
}
|
||||||
@ -47,7 +46,7 @@ impl SecretStoreClient {
|
|||||||
/// Attempt to get the `Arc<AccountProvider>`, errors if provider was not
|
/// Attempt to get the `Arc<AccountProvider>`, errors if provider was not
|
||||||
/// set.
|
/// set.
|
||||||
fn account_provider(&self) -> Result<Arc<AccountProvider>> {
|
fn account_provider(&self) -> Result<Arc<AccountProvider>> {
|
||||||
unwrap_provider(&self.accounts)
|
Ok(self.accounts.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Decrypt public key using account' private key
|
/// Decrypt public key using account' private key
|
||||||
|
@ -30,7 +30,6 @@ use jsonrpc_core::futures::{future, Future, IntoFuture};
|
|||||||
use jsonrpc_core::futures::future::Either;
|
use jsonrpc_core::futures::future::Either;
|
||||||
use jsonrpc_pubsub::SubscriptionId;
|
use jsonrpc_pubsub::SubscriptionId;
|
||||||
use jsonrpc_macros::pubsub::{Sink, Subscriber};
|
use jsonrpc_macros::pubsub::{Sink, Subscriber};
|
||||||
use v1::helpers::accounts::unwrap_provider;
|
|
||||||
use v1::helpers::dispatch::{self, Dispatcher, WithToken, eth_data_hash};
|
use v1::helpers::dispatch::{self, Dispatcher, WithToken, eth_data_hash};
|
||||||
use v1::helpers::{errors, SignerService, SigningQueue, ConfirmationPayload, FilledTransactionRequest, Subscribers};
|
use v1::helpers::{errors, SignerService, SigningQueue, ConfirmationPayload, FilledTransactionRequest, Subscribers};
|
||||||
use v1::metadata::Metadata;
|
use v1::metadata::Metadata;
|
||||||
@ -40,7 +39,7 @@ use v1::types::{TransactionModification, ConfirmationRequest, ConfirmationRespon
|
|||||||
/// Transactions confirmation (personal) rpc implementation.
|
/// Transactions confirmation (personal) rpc implementation.
|
||||||
pub struct SignerClient<D: Dispatcher> {
|
pub struct SignerClient<D: Dispatcher> {
|
||||||
signer: Arc<SignerService>,
|
signer: Arc<SignerService>,
|
||||||
accounts: Option<Arc<AccountProvider>>,
|
accounts: Arc<AccountProvider>,
|
||||||
dispatcher: D,
|
dispatcher: D,
|
||||||
subscribers: Arc<Mutex<Subscribers<Sink<Vec<ConfirmationRequest>>>>>,
|
subscribers: Arc<Mutex<Subscribers<Sink<Vec<ConfirmationRequest>>>>>,
|
||||||
}
|
}
|
||||||
@ -48,7 +47,7 @@ pub struct SignerClient<D: Dispatcher> {
|
|||||||
impl<D: Dispatcher + 'static> SignerClient<D> {
|
impl<D: Dispatcher + 'static> SignerClient<D> {
|
||||||
/// Create new instance of signer client.
|
/// Create new instance of signer client.
|
||||||
pub fn new(
|
pub fn new(
|
||||||
store: &Option<Arc<AccountProvider>>,
|
store: &Arc<AccountProvider>,
|
||||||
dispatcher: D,
|
dispatcher: D,
|
||||||
signer: &Arc<SignerService>,
|
signer: &Arc<SignerService>,
|
||||||
remote: Remote,
|
remote: Remote,
|
||||||
@ -79,7 +78,7 @@ impl<D: Dispatcher + 'static> SignerClient<D> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn account_provider(&self) -> Result<Arc<AccountProvider>> {
|
fn account_provider(&self) -> Result<Arc<AccountProvider>> {
|
||||||
unwrap_provider(&self.accounts)
|
Ok(self.accounts.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn confirm_internal<F, T>(&self, id: U256, modification: TransactionModification, f: F) -> BoxFuture<WithToken<ConfirmationResponse>> where
|
fn confirm_internal<F, T>(&self, id: U256, modification: TransactionModification, f: F) -> BoxFuture<WithToken<ConfirmationResponse>> where
|
||||||
|
@ -32,7 +32,6 @@ use v1::helpers::{
|
|||||||
ConfirmationResult as RpcConfirmationResult,
|
ConfirmationResult as RpcConfirmationResult,
|
||||||
};
|
};
|
||||||
use v1::helpers::dispatch::{self, Dispatcher};
|
use v1::helpers::dispatch::{self, Dispatcher};
|
||||||
use v1::helpers::accounts::unwrap_provider;
|
|
||||||
use v1::metadata::Metadata;
|
use v1::metadata::Metadata;
|
||||||
use v1::traits::{EthSigning, ParitySigning};
|
use v1::traits::{EthSigning, ParitySigning};
|
||||||
use v1::types::{
|
use v1::types::{
|
||||||
@ -90,7 +89,7 @@ fn schedule(remote: Remote,
|
|||||||
/// Implementation of functions that require signing when no trusted signer is used.
|
/// Implementation of functions that require signing when no trusted signer is used.
|
||||||
pub struct SigningQueueClient<D> {
|
pub struct SigningQueueClient<D> {
|
||||||
signer: Arc<SignerService>,
|
signer: Arc<SignerService>,
|
||||||
accounts: Option<Arc<AccountProvider>>,
|
accounts: Arc<AccountProvider>,
|
||||||
dispatcher: D,
|
dispatcher: D,
|
||||||
remote: Remote,
|
remote: Remote,
|
||||||
// None here means that the request hasn't yet been confirmed
|
// None here means that the request hasn't yet been confirmed
|
||||||
@ -99,7 +98,7 @@ pub struct SigningQueueClient<D> {
|
|||||||
|
|
||||||
impl<D: Dispatcher + 'static> SigningQueueClient<D> {
|
impl<D: Dispatcher + 'static> SigningQueueClient<D> {
|
||||||
/// Creates a new signing queue client given shared signing queue.
|
/// Creates a new signing queue client given shared signing queue.
|
||||||
pub fn new(signer: &Arc<SignerService>, dispatcher: D, remote: Remote, accounts: &Option<Arc<AccountProvider>>) -> Self {
|
pub fn new(signer: &Arc<SignerService>, dispatcher: D, remote: Remote, accounts: &Arc<AccountProvider>) -> Self {
|
||||||
SigningQueueClient {
|
SigningQueueClient {
|
||||||
signer: signer.clone(),
|
signer: signer.clone(),
|
||||||
accounts: accounts.clone(),
|
accounts: accounts.clone(),
|
||||||
@ -110,7 +109,7 @@ impl<D: Dispatcher + 'static> SigningQueueClient<D> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn account_provider(&self) -> Result<Arc<AccountProvider>> {
|
fn account_provider(&self) -> Result<Arc<AccountProvider>> {
|
||||||
unwrap_provider(&self.accounts)
|
Ok(self.accounts.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dispatch(&self, payload: RpcConfirmationPayload, default_account: DefaultAccount, origin: Origin) -> BoxFuture<DispatchResult> {
|
fn dispatch(&self, payload: RpcConfirmationPayload, default_account: DefaultAccount, origin: Origin) -> BoxFuture<DispatchResult> {
|
||||||
|
@ -24,7 +24,6 @@ use jsonrpc_core::{BoxFuture, Result};
|
|||||||
use jsonrpc_core::futures::{future, Future};
|
use jsonrpc_core::futures::{future, Future};
|
||||||
use v1::helpers::{errors, DefaultAccount};
|
use v1::helpers::{errors, DefaultAccount};
|
||||||
use v1::helpers::dispatch::{self, Dispatcher};
|
use v1::helpers::dispatch::{self, Dispatcher};
|
||||||
use v1::helpers::accounts::unwrap_provider;
|
|
||||||
use v1::metadata::Metadata;
|
use v1::metadata::Metadata;
|
||||||
use v1::traits::{EthSigning, ParitySigning};
|
use v1::traits::{EthSigning, ParitySigning};
|
||||||
use v1::types::{
|
use v1::types::{
|
||||||
@ -39,13 +38,13 @@ use v1::types::{
|
|||||||
|
|
||||||
/// Implementation of functions that require signing when no trusted signer is used.
|
/// Implementation of functions that require signing when no trusted signer is used.
|
||||||
pub struct SigningUnsafeClient<D> {
|
pub struct SigningUnsafeClient<D> {
|
||||||
accounts: Option<Arc<AccountProvider>>,
|
accounts: Arc<AccountProvider>,
|
||||||
dispatcher: D,
|
dispatcher: D,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<D: Dispatcher + 'static> SigningUnsafeClient<D> {
|
impl<D: Dispatcher + 'static> SigningUnsafeClient<D> {
|
||||||
/// Creates new SigningUnsafeClient.
|
/// Creates new SigningUnsafeClient.
|
||||||
pub fn new(accounts: &Option<Arc<AccountProvider>>, dispatcher: D) -> Self {
|
pub fn new(accounts: &Arc<AccountProvider>, dispatcher: D) -> Self {
|
||||||
SigningUnsafeClient {
|
SigningUnsafeClient {
|
||||||
accounts: accounts.clone(),
|
accounts: accounts.clone(),
|
||||||
dispatcher: dispatcher,
|
dispatcher: dispatcher,
|
||||||
@ -53,7 +52,7 @@ impl<D: Dispatcher + 'static> SigningUnsafeClient<D> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn account_provider(&self) -> Result<Arc<AccountProvider>> {
|
fn account_provider(&self) -> Result<Arc<AccountProvider>> {
|
||||||
unwrap_provider(&self.accounts)
|
Ok(self.accounts.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle(&self, payload: RpcConfirmationPayload, account: DefaultAccount) -> BoxFuture<RpcConfirmationResponse> {
|
fn handle(&self, payload: RpcConfirmationPayload, account: DefaultAccount) -> BoxFuture<RpcConfirmationResponse> {
|
||||||
|
@ -101,7 +101,7 @@ impl EthTester {
|
|||||||
|
|
||||||
fn from_spec(spec: Spec) -> Self {
|
fn from_spec(spec: Spec) -> Self {
|
||||||
let account_provider = account_provider();
|
let account_provider = account_provider();
|
||||||
let opt_account_provider = Some(account_provider.clone());
|
let opt_account_provider = account_provider.clone();
|
||||||
let miner_service = miner_service(&spec, account_provider.clone());
|
let miner_service = miner_service(&spec, account_provider.clone());
|
||||||
let snapshot_service = snapshot_service();
|
let snapshot_service = snapshot_service();
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ impl EthTester {
|
|||||||
let client = blockchain_client();
|
let client = blockchain_client();
|
||||||
let sync = sync_provider();
|
let sync = sync_provider();
|
||||||
let ap = accounts_provider();
|
let ap = accounts_provider();
|
||||||
let opt_ap = Some(ap.clone());
|
let opt_ap = ap.clone();
|
||||||
let miner = miner_service();
|
let miner = miner_service();
|
||||||
let snapshot = snapshot_service();
|
let snapshot = snapshot_service();
|
||||||
let hashrates = Arc::new(Mutex::new(HashMap::new()));
|
let hashrates = Arc::new(Mutex::new(HashMap::new()));
|
||||||
|
@ -81,7 +81,7 @@ impl Dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn client(&self, signer: Option<Arc<SignerService>>) -> TestParityClient {
|
pub fn client(&self, signer: Option<Arc<SignerService>>) -> TestParityClient {
|
||||||
let opt_accounts = Some(self.accounts.clone());
|
let opt_accounts = self.accounts.clone();
|
||||||
|
|
||||||
ParityClient::new(
|
ParityClient::new(
|
||||||
self.client.clone(),
|
self.client.clone(),
|
||||||
|
@ -40,7 +40,7 @@ fn accounts_provider_with_vaults_support(temp_path: &str) -> Arc<AccountProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn setup_with_accounts_provider(accounts_provider: Arc<AccountProvider>) -> ParityAccountsTester {
|
fn setup_with_accounts_provider(accounts_provider: Arc<AccountProvider>) -> ParityAccountsTester {
|
||||||
let opt_ap = Some(accounts_provider.clone());
|
let opt_ap = accounts_provider.clone();
|
||||||
let parity_accounts = ParityAccountsClient::new(&opt_ap);
|
let parity_accounts = ParityAccountsClient::new(&opt_ap);
|
||||||
let mut io = IoHandler::default();
|
let mut io = IoHandler::default();
|
||||||
io.extend_with(parity_accounts.to_delegate());
|
io.extend_with(parity_accounts.to_delegate());
|
||||||
|
@ -52,13 +52,13 @@ fn miner_service() -> Arc<TestMinerService> {
|
|||||||
|
|
||||||
fn setup() -> PersonalTester {
|
fn setup() -> PersonalTester {
|
||||||
let accounts = accounts_provider();
|
let accounts = accounts_provider();
|
||||||
let opt_accounts = Some(accounts.clone());
|
let opt_accounts = accounts.clone();
|
||||||
let client = blockchain_client();
|
let client = blockchain_client();
|
||||||
let miner = miner_service();
|
let miner = miner_service();
|
||||||
let reservations = Arc::new(Mutex::new(nonce::Reservations::new()));
|
let reservations = Arc::new(Mutex::new(nonce::Reservations::new()));
|
||||||
|
|
||||||
let dispatcher = FullDispatcher::new(client, miner.clone(), reservations, 50);
|
let dispatcher = FullDispatcher::new(client, miner.clone(), reservations, 50);
|
||||||
let personal = PersonalClient::new(opt_accounts, dispatcher, false);
|
let personal = PersonalClient::new(&opt_accounts, dispatcher, false);
|
||||||
|
|
||||||
let mut io = IoHandler::default();
|
let mut io = IoHandler::default();
|
||||||
io.extend_with(personal.to_delegate());
|
io.extend_with(personal.to_delegate());
|
||||||
|
@ -40,7 +40,7 @@ impl Dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn client(&self) -> SecretStoreClient {
|
pub fn client(&self) -> SecretStoreClient {
|
||||||
SecretStoreClient::new(&Some(self.accounts.clone()))
|
SecretStoreClient::new(&self.accounts)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_client(&self) -> IoHandler<Metadata> {
|
fn default_client(&self) -> IoHandler<Metadata> {
|
||||||
|
@ -58,7 +58,7 @@ fn miner_service() -> Arc<TestMinerService> {
|
|||||||
fn signer_tester() -> SignerTester {
|
fn signer_tester() -> SignerTester {
|
||||||
let signer = Arc::new(SignerService::new_test(false));
|
let signer = Arc::new(SignerService::new_test(false));
|
||||||
let accounts = accounts_provider();
|
let accounts = accounts_provider();
|
||||||
let opt_accounts = Some(accounts.clone());
|
let opt_accounts = accounts.clone();
|
||||||
let client = blockchain_client();
|
let client = blockchain_client();
|
||||||
let miner = miner_service();
|
let miner = miner_service();
|
||||||
let reservations = Arc::new(Mutex::new(nonce::Reservations::new()));
|
let reservations = Arc::new(Mutex::new(nonce::Reservations::new()));
|
||||||
|
@ -56,7 +56,7 @@ impl Default for SigningTester {
|
|||||||
let client = Arc::new(TestBlockChainClient::default());
|
let client = Arc::new(TestBlockChainClient::default());
|
||||||
let miner = Arc::new(TestMinerService::default());
|
let miner = Arc::new(TestMinerService::default());
|
||||||
let accounts = Arc::new(AccountProvider::transient_provider());
|
let accounts = Arc::new(AccountProvider::transient_provider());
|
||||||
let opt_accounts = Some(accounts.clone());
|
let opt_accounts = accounts.clone();
|
||||||
let reservations = Arc::new(Mutex::new(nonce::Reservations::new()));
|
let reservations = Arc::new(Mutex::new(nonce::Reservations::new()));
|
||||||
let mut io = IoHandler::default();
|
let mut io = IoHandler::default();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user