diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index fea060d59..facd01dbf 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -240,10 +240,6 @@ usage! { { // Global flags and arguments ["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(), "--no-download", "Normally new releases will be downloaded ready for updating. This disables it. Not recommended.", @@ -948,6 +944,10 @@ usage! { "--rpc", "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) = None, or |c: &Config| c.dapps.as_ref()?.port.clone(), "--dapps-port=[PORT]", "Dapps server is merged with RPC server. Use --jsonrpc-port.", @@ -1070,7 +1070,6 @@ struct Operating { auto_update_delay: Option, auto_update_check_frequency: Option, release_track: Option, - public_node: Option, no_download: Option, no_consensus: Option, chain: Option, @@ -1081,6 +1080,9 @@ struct Operating { light: Option, no_persistent_txqueue: Option, no_hardcoded_sync: Option, + + #[serde(rename="public_node")] + _legacy_public_node: Option, } #[derive(Default, Debug, PartialEq, Deserialize)] @@ -1797,7 +1799,6 @@ mod tests { auto_update_delay: None, auto_update_check_frequency: None, release_track: None, - public_node: None, no_download: None, no_consensus: None, chain: Some("./chain.json".into()), @@ -1808,6 +1809,7 @@ mod tests { light: None, no_hardcoded_sync: None, no_persistent_txqueue: None, + _legacy_public_node: None, }), account: Some(Account { unlock: Some(vec!["0x1".into(), "0x2".into(), "0x3".into()]), diff --git a/parity/configuration.rs b/parity/configuration.rs index 6bec636e2..426b65101 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -35,7 +35,6 @@ use ethcore::verification::queue::VerifierSettings; use miner::pool; use rpc::{IpcConfiguration, HttpConfiguration, WsConfiguration, UiConfiguration}; -use rpc_apis::ApiSet; use parity_rpc::NetworkSettings; 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}; @@ -138,7 +137,6 @@ impl Configuration { let fat_db = self.args.arg_fat_db.parse()?; let compaction = self.args.arg_db_compaction.parse()?; 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 geth_compatibility = self.args.flag_geth; let dapps_conf = self.dapps_config(); @@ -379,7 +377,6 @@ impl Configuration { vm_type: vm_type, warp_sync: warp_sync, warp_barrier: self.args.arg_warp_barrier, - public_node: public_node, geth_compatibility: geth_compatibility, net_settings: self.network_settings()?, dapps_conf: dapps_conf, @@ -914,10 +911,7 @@ impl Configuration { enabled: self.rpc_enabled(), interface: self.rpc_interface(), port: self.args.arg_ports_shift + self.args.arg_rpcport.unwrap_or(self.args.arg_jsonrpc_port), - apis: match self.args.flag_public_node { - false => self.rpc_apis().parse()?, - true => self.rpc_apis().parse::()?.retain(ApiSet::PublicContext), - }, + apis: self.rpc_apis().parse()?, hosts: self.rpc_hosts(), cors: self.rpc_cors(), server_threads: match self.args.arg_jsonrpc_server_threads { @@ -935,10 +929,8 @@ impl Configuration { let http = self.http_config()?; let support_token_api = - // never enabled for public node - !self.args.flag_public_node - // enabled when not unlocking unless the ui is forced - && (self.args.arg_unlock.is_none() || ui.enabled); + // enabled when not unlocking + self.args.arg_unlock.is_none(); let conf = WsConfiguration { enabled: self.ws_enabled(), @@ -1263,6 +1255,7 @@ mod tests { use params::SpecType; use presale::ImportWallet; use rpc::{WsConfiguration, UiConfiguration}; + use rpc_apis::ApiSet; use run::RunCmd; use network::{AllowIP, IpFilter}; @@ -1499,7 +1492,6 @@ mod tests { ipc_conf: Default::default(), net_conf: default_network_config(), network_id: None, - public_node: false, warp_sync: true, warp_barrier: None, acc_conf: Default::default(), diff --git a/parity/rpc_apis.rs b/parity/rpc_apis.rs index 7b914f286..855f917b1 100644 --- a/parity/rpc_apis.rs +++ b/parity/rpc_apis.rs @@ -116,8 +116,6 @@ pub enum ApiSet { SafeContext, // Unsafe context (like jsonrpc over http) UnsafeContext, - // Public context (like public jsonrpc over http) - PublicContext, // All possible APIs All, // Local "unsafe" context and accounts access @@ -219,7 +217,7 @@ pub struct FullDependencies { pub snapshot: Arc, pub sync: Arc, pub net: Arc, - pub secret_store: Option>, + pub secret_store: Arc, pub private_tx_service: Option>, pub miner: Arc, pub external_miner: Arc, @@ -316,7 +314,7 @@ impl FullDependencies { } }, 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 => { handler.extend_with(SignerClient::new(&self.secret_store, dispatcher.clone(), &self.signer_service, self.remote.clone()).to_delegate()); @@ -475,7 +473,7 @@ impl LightDependencies { { let deps = &$deps; 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() { $handler.extend_with($namespace::to_delegate( SigningQueueClient::new(&deps.signer_service, dispatcher, deps.remote.clone(), &secret_store) @@ -533,12 +531,10 @@ impl LightDependencies { handler.extend_with(EthPubSub::to_delegate(client)); }, Api::Personal => { - let secret_store = Some(self.secret_store.clone()); - handler.extend_with(PersonalClient::new(secret_store, dispatcher.clone(), self.geth_compatibility).to_delegate()); + handler.extend_with(PersonalClient::new(&self.secret_store, dispatcher.clone(), self.geth_compatibility).to_delegate()); }, Api::Signer => { - let secret_store = Some(self.secret_store.clone()); - handler.extend_with(SignerClient::new(&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()); }, Api::Parity => { let signer = match self.signer_service.is_enabled() { @@ -571,8 +567,7 @@ impl LightDependencies { } }, Api::ParityAccounts => { - let secret_store = Some(self.secret_store.clone()); - handler.extend_with(ParityAccountsClient::new(&secret_store).to_delegate()); + handler.extend_with(ParityAccountsClient::new(&self.secret_store).to_delegate()); }, Api::ParitySet => { handler.extend_with(light::ParitySetClient::new( @@ -590,8 +585,7 @@ impl LightDependencies { handler.extend_with(RpcClient::new(modules).to_delegate()); }, Api::SecretStore => { - let secret_store = Some(self.secret_store.clone()); - handler.extend_with(SecretStoreClient::new(&secret_store).to_delegate()); + handler.extend_with(SecretStoreClient::new(&self.secret_store).to_delegate()); }, Api::Whisper => { if let Some(ref whisper_rpc) = self.whisper_rpc { @@ -637,7 +631,7 @@ impl ApiSet { } pub fn list_apis(&self) -> HashSet { - let mut public_list = [ + let mut public_list: HashSet = [ Api::Web3, Api::Net, Api::Eth, @@ -651,7 +645,6 @@ impl ApiSet { match *self { ApiSet::List(ref apis) => apis.clone(), - ApiSet::PublicContext => public_list, ApiSet::UnsafeContext => { public_list.insert(Api::Traces); public_list.insert(Api::ParityPubSub); diff --git a/parity/run.rs b/parity/run.rs index 31f8779c0..bd8d4fb4a 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -98,7 +98,6 @@ pub struct RunCmd { pub network_id: Option, pub warp_sync: bool, pub warp_barrier: Option, - pub public_node: bool, pub acc_conf: AccountsConfig, pub gas_pricer_conf: GasPricerConfig, pub miner_extras: MinerExtras, @@ -721,11 +720,7 @@ fn execute_impl(cmd: RunCmd, logger: Arc, on_client_rq: // set up dependencies for rpc servers let rpc_stats = Arc::new(informant::RpcStats::default()); - let secret_store = match cmd.public_node { - true => None, - false => Some(account_provider.clone()) - }; - + let secret_store = account_provider.clone(); let signer_service = Arc::new(signer::new_service(&cmd.ws_conf, &cmd.logger_config)); // the dapps server diff --git a/rpc/src/v1/helpers/accounts.rs b/rpc/src/v1/helpers/accounts.rs deleted file mode 100644 index 970603935..000000000 --- a/rpc/src/v1/helpers/accounts.rs +++ /dev/null @@ -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 . - -use std::sync::Arc; -use ethcore::account_provider::AccountProvider; -use jsonrpc_core::Error; -use v1::helpers::errors; - -pub fn unwrap_provider(provider: &Option>) -> Result, Error> { - match *provider { - Some(ref arc) => Ok(arc.clone()), - None => Err(errors::public_unsupported(None)), - } -} diff --git a/rpc/src/v1/helpers/errors.rs b/rpc/src/v1/helpers/errors.rs index c85beef7d..0d36a926e 100644 --- a/rpc/src/v1/helpers/errors.rs +++ b/rpc/src/v1/helpers/errors.rs @@ -68,14 +68,6 @@ pub fn light_unimplemented(details: Option) -> Error { } } -pub fn public_unsupported(details: Option) -> 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>(msg: T, details: Option) -> Error { Error { code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST), diff --git a/rpc/src/v1/helpers/mod.rs b/rpc/src/v1/helpers/mod.rs index 7cd4e6f60..9adb5d68d 100644 --- a/rpc/src/v1/helpers/mod.rs +++ b/rpc/src/v1/helpers/mod.rs @@ -17,7 +17,6 @@ #[macro_use] pub mod errors; -pub mod accounts; pub mod block_import; pub mod dapps; pub mod dispatch; diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index ae8d611c1..32ba36deb 100644 --- a/rpc/src/v1/impls/eth.rs +++ b/rpc/src/v1/impls/eth.rs @@ -45,7 +45,6 @@ use jsonrpc_macros::Trailing; use v1::helpers::{errors, limit_logs, fake_sign}; use v1::helpers::dispatch::{FullDispatcher, default_gas_price}; use v1::helpers::block_import::is_major_importing; -use v1::helpers::accounts::unwrap_provider; use v1::traits::Eth; use v1::types::{ RichBlock, Block, BlockTransactions, BlockNumber, Bytes, SyncStatus, SyncInfo, @@ -100,7 +99,7 @@ pub struct EthClient where client: Arc, snapshot: Arc, sync: Arc, - accounts: Option>, + accounts: Arc, miner: Arc, external_miner: Arc, seed_compute: Mutex, @@ -153,7 +152,7 @@ impl EthClient, snapshot: &Arc, sync: &Arc, - accounts: &Option>, + accounts: &Arc, miner: &Arc, em: &Arc, options: EthClientOptions @@ -174,7 +173,7 @@ impl EthClient`, errors if provider was not /// set. fn account_provider(&self) -> Result> { - unwrap_provider(&self.accounts) + Ok(self.accounts.clone()) } fn rich_block(&self, id: BlockNumberOrId, include_txs: bool) -> Result> { diff --git a/rpc/src/v1/impls/parity.rs b/rpc/src/v1/impls/parity.rs index 3fa9cb991..f5d4a5894 100644 --- a/rpc/src/v1/impls/parity.rs +++ b/rpc/src/v1/impls/parity.rs @@ -40,7 +40,6 @@ use jsonrpc_core::{BoxFuture, Result}; use jsonrpc_core::futures::{future, Future}; use jsonrpc_macros::Trailing; use v1::helpers::{self, errors, fake_sign, ipfs, SigningQueue, SignerService, NetworkSettings}; -use v1::helpers::accounts::unwrap_provider; use v1::metadata::Metadata; use v1::traits::Parity; use v1::types::{ @@ -62,7 +61,7 @@ pub struct ParityClient { sync: Arc, net: Arc, health: NodeHealth, - accounts: Option>, + accounts: Arc, logger: Arc, settings: Arc, signer: Option>, @@ -82,7 +81,7 @@ impl ParityClient where updater: Arc, net: Arc, health: NodeHealth, - accounts: Option>, + accounts: Arc, logger: Arc, settings: Arc, signer: Option>, @@ -110,7 +109,7 @@ impl ParityClient where /// Attempt to get the `Arc`, errors if provider was not /// set. fn account_provider(&self) -> Result> { - unwrap_provider(&self.accounts) + Ok(self.accounts.clone()) } } @@ -349,11 +348,6 @@ impl Parity for ParityClient where } fn local_transactions(&self) -> Result> { - // 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 block_number = self.client.chain_info().best_block_number; Ok(transactions @@ -418,13 +412,8 @@ impl Parity for ParityClient where fn node_kind(&self) -> Result<::v1::types::NodeKind> { use ::v1::types::{NodeKind, Availability, Capability}; - let availability = match self.accounts { - Some(_) => Availability::Personal, - None => Availability::Public - }; - Ok(NodeKind { - availability: availability, + availability: Availability::Personal, capability: Capability::Full, }) } diff --git a/rpc/src/v1/impls/parity_accounts.rs b/rpc/src/v1/impls/parity_accounts.rs index 8de8fea90..adb97db28 100644 --- a/rpc/src/v1/impls/parity_accounts.rs +++ b/rpc/src/v1/impls/parity_accounts.rs @@ -25,18 +25,17 @@ use ethcore::account_provider::AccountProvider; use jsonrpc_core::Result; use v1::helpers::errors; -use v1::helpers::accounts::unwrap_provider; use v1::traits::ParityAccounts; use v1::types::{H160 as RpcH160, H256 as RpcH256, H520 as RpcH520, DappId, Derive, DeriveHierarchical, DeriveHash, ExtAccountInfo}; /// Account management (personal) rpc implementation. pub struct ParityAccountsClient { - accounts: Option>, + accounts: Arc, } impl ParityAccountsClient { /// Creates new PersonalClient - pub fn new(store: &Option>) -> Self { + pub fn new(store: &Arc) -> Self { ParityAccountsClient { accounts: store.clone(), } @@ -45,7 +44,7 @@ impl ParityAccountsClient { /// Attempt to get the `Arc`, errors if provider was not /// set. fn account_provider(&self) -> Result> { - unwrap_provider(&self.accounts) + Ok(self.accounts.clone()) } } diff --git a/rpc/src/v1/impls/personal.rs b/rpc/src/v1/impls/personal.rs index 03495fd37..da5ef983a 100644 --- a/rpc/src/v1/impls/personal.rs +++ b/rpc/src/v1/impls/personal.rs @@ -28,7 +28,6 @@ use jsonrpc_core::{BoxFuture, Result}; use jsonrpc_core::futures::{future, Future}; use v1::helpers::errors; use v1::helpers::dispatch::{self, eth_data_hash, Dispatcher, SignWith}; -use v1::helpers::accounts::unwrap_provider; use v1::traits::Personal; use v1::types::{ 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. pub struct PersonalClient { - accounts: Option>, + accounts: Arc, dispatcher: D, allow_perm_unlock: bool, } impl PersonalClient { /// Creates new PersonalClient - pub fn new(accounts: Option>, dispatcher: D, allow_perm_unlock: bool) -> Self { + pub fn new(accounts: &Arc, dispatcher: D, allow_perm_unlock: bool) -> Self { PersonalClient { - accounts, + accounts: accounts.clone(), dispatcher, allow_perm_unlock, } } fn account_provider(&self) -> Result> { - unwrap_provider(&self.accounts) + Ok(self.accounts.clone()) } } diff --git a/rpc/src/v1/impls/private.rs b/rpc/src/v1/impls/private.rs index ab5866e4a..4034d2b9a 100644 --- a/rpc/src/v1/impls/private.rs +++ b/rpc/src/v1/impls/private.rs @@ -47,7 +47,7 @@ impl PrivateClient { fn unwrap_manager(&self) -> Result<&PrivateTransactionManager, Error> { match self.private { 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()) } } - diff --git a/rpc/src/v1/impls/secretstore.rs b/rpc/src/v1/impls/secretstore.rs index 5a60192e8..f85fa6f58 100644 --- a/rpc/src/v1/impls/secretstore.rs +++ b/rpc/src/v1/impls/secretstore.rs @@ -25,7 +25,6 @@ use ethcore::account_provider::AccountProvider; use jsonrpc_core::Result; use v1::helpers::errors; -use v1::helpers::accounts::unwrap_provider; use v1::helpers::secretstore::{generate_document_key, encrypt_document, decrypt_document, decrypt_document_with_shadow, ordered_servers_keccak}; use v1::traits::SecretStore; @@ -33,12 +32,12 @@ use v1::types::{H160, H256, H512, Bytes, EncryptedDocumentKey}; /// Parity implementation. pub struct SecretStoreClient { - accounts: Option>, + accounts: Arc, } impl SecretStoreClient { /// Creates new SecretStoreClient - pub fn new(store: &Option>) -> Self { + pub fn new(store: &Arc) -> Self { SecretStoreClient { accounts: store.clone(), } @@ -47,7 +46,7 @@ impl SecretStoreClient { /// Attempt to get the `Arc`, errors if provider was not /// set. fn account_provider(&self) -> Result> { - unwrap_provider(&self.accounts) + Ok(self.accounts.clone()) } /// Decrypt public key using account' private key diff --git a/rpc/src/v1/impls/signer.rs b/rpc/src/v1/impls/signer.rs index 2e8d41c4a..eafa07ad4 100644 --- a/rpc/src/v1/impls/signer.rs +++ b/rpc/src/v1/impls/signer.rs @@ -30,7 +30,6 @@ use jsonrpc_core::futures::{future, Future, IntoFuture}; use jsonrpc_core::futures::future::Either; use jsonrpc_pubsub::SubscriptionId; 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::{errors, SignerService, SigningQueue, ConfirmationPayload, FilledTransactionRequest, Subscribers}; use v1::metadata::Metadata; @@ -40,7 +39,7 @@ use v1::types::{TransactionModification, ConfirmationRequest, ConfirmationRespon /// Transactions confirmation (personal) rpc implementation. pub struct SignerClient { signer: Arc, - accounts: Option>, + accounts: Arc, dispatcher: D, subscribers: Arc>>>>, } @@ -48,7 +47,7 @@ pub struct SignerClient { impl SignerClient { /// Create new instance of signer client. pub fn new( - store: &Option>, + store: &Arc, dispatcher: D, signer: &Arc, remote: Remote, @@ -79,7 +78,7 @@ impl SignerClient { } fn account_provider(&self) -> Result> { - unwrap_provider(&self.accounts) + Ok(self.accounts.clone()) } fn confirm_internal(&self, id: U256, modification: TransactionModification, f: F) -> BoxFuture> where diff --git a/rpc/src/v1/impls/signing.rs b/rpc/src/v1/impls/signing.rs index d8a27e952..71cf18a06 100644 --- a/rpc/src/v1/impls/signing.rs +++ b/rpc/src/v1/impls/signing.rs @@ -32,7 +32,6 @@ use v1::helpers::{ ConfirmationResult as RpcConfirmationResult, }; use v1::helpers::dispatch::{self, Dispatcher}; -use v1::helpers::accounts::unwrap_provider; use v1::metadata::Metadata; use v1::traits::{EthSigning, ParitySigning}; use v1::types::{ @@ -90,7 +89,7 @@ fn schedule(remote: Remote, /// Implementation of functions that require signing when no trusted signer is used. pub struct SigningQueueClient { signer: Arc, - accounts: Option>, + accounts: Arc, dispatcher: D, remote: Remote, // None here means that the request hasn't yet been confirmed @@ -99,7 +98,7 @@ pub struct SigningQueueClient { impl SigningQueueClient { /// Creates a new signing queue client given shared signing queue. - pub fn new(signer: &Arc, dispatcher: D, remote: Remote, accounts: &Option>) -> Self { + pub fn new(signer: &Arc, dispatcher: D, remote: Remote, accounts: &Arc) -> Self { SigningQueueClient { signer: signer.clone(), accounts: accounts.clone(), @@ -110,7 +109,7 @@ impl SigningQueueClient { } fn account_provider(&self) -> Result> { - unwrap_provider(&self.accounts) + Ok(self.accounts.clone()) } fn dispatch(&self, payload: RpcConfirmationPayload, default_account: DefaultAccount, origin: Origin) -> BoxFuture { diff --git a/rpc/src/v1/impls/signing_unsafe.rs b/rpc/src/v1/impls/signing_unsafe.rs index ddac36a61..75f5f5e2b 100644 --- a/rpc/src/v1/impls/signing_unsafe.rs +++ b/rpc/src/v1/impls/signing_unsafe.rs @@ -24,7 +24,6 @@ use jsonrpc_core::{BoxFuture, Result}; use jsonrpc_core::futures::{future, Future}; use v1::helpers::{errors, DefaultAccount}; use v1::helpers::dispatch::{self, Dispatcher}; -use v1::helpers::accounts::unwrap_provider; use v1::metadata::Metadata; use v1::traits::{EthSigning, ParitySigning}; use v1::types::{ @@ -39,13 +38,13 @@ use v1::types::{ /// Implementation of functions that require signing when no trusted signer is used. pub struct SigningUnsafeClient { - accounts: Option>, + accounts: Arc, dispatcher: D, } impl SigningUnsafeClient { /// Creates new SigningUnsafeClient. - pub fn new(accounts: &Option>, dispatcher: D) -> Self { + pub fn new(accounts: &Arc, dispatcher: D) -> Self { SigningUnsafeClient { accounts: accounts.clone(), dispatcher: dispatcher, @@ -53,7 +52,7 @@ impl SigningUnsafeClient { } fn account_provider(&self) -> Result> { - unwrap_provider(&self.accounts) + Ok(self.accounts.clone()) } fn handle(&self, payload: RpcConfirmationPayload, account: DefaultAccount) -> BoxFuture { diff --git a/rpc/src/v1/tests/eth.rs b/rpc/src/v1/tests/eth.rs index 26117471c..e0931ae6b 100644 --- a/rpc/src/v1/tests/eth.rs +++ b/rpc/src/v1/tests/eth.rs @@ -101,7 +101,7 @@ impl EthTester { fn from_spec(spec: Spec) -> Self { 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 snapshot_service = snapshot_service(); diff --git a/rpc/src/v1/tests/mocked/eth.rs b/rpc/src/v1/tests/mocked/eth.rs index 39a2e842d..a6c877243 100644 --- a/rpc/src/v1/tests/mocked/eth.rs +++ b/rpc/src/v1/tests/mocked/eth.rs @@ -86,7 +86,7 @@ impl EthTester { let client = blockchain_client(); let sync = sync_provider(); let ap = accounts_provider(); - let opt_ap = Some(ap.clone()); + let opt_ap = ap.clone(); let miner = miner_service(); let snapshot = snapshot_service(); let hashrates = Arc::new(Mutex::new(HashMap::new())); diff --git a/rpc/src/v1/tests/mocked/parity.rs b/rpc/src/v1/tests/mocked/parity.rs index 5835e2e82..c27615a58 100644 --- a/rpc/src/v1/tests/mocked/parity.rs +++ b/rpc/src/v1/tests/mocked/parity.rs @@ -81,7 +81,7 @@ impl Dependencies { } pub fn client(&self, signer: Option>) -> TestParityClient { - let opt_accounts = Some(self.accounts.clone()); + let opt_accounts = self.accounts.clone(); ParityClient::new( self.client.clone(), diff --git a/rpc/src/v1/tests/mocked/parity_accounts.rs b/rpc/src/v1/tests/mocked/parity_accounts.rs index 258310b85..c30b4b9ce 100644 --- a/rpc/src/v1/tests/mocked/parity_accounts.rs +++ b/rpc/src/v1/tests/mocked/parity_accounts.rs @@ -40,7 +40,7 @@ fn accounts_provider_with_vaults_support(temp_path: &str) -> Arc) -> ParityAccountsTester { - let opt_ap = Some(accounts_provider.clone()); + let opt_ap = accounts_provider.clone(); let parity_accounts = ParityAccountsClient::new(&opt_ap); let mut io = IoHandler::default(); io.extend_with(parity_accounts.to_delegate()); diff --git a/rpc/src/v1/tests/mocked/personal.rs b/rpc/src/v1/tests/mocked/personal.rs index c11aca42f..323f9fe13 100644 --- a/rpc/src/v1/tests/mocked/personal.rs +++ b/rpc/src/v1/tests/mocked/personal.rs @@ -52,13 +52,13 @@ fn miner_service() -> Arc { fn setup() -> PersonalTester { let accounts = accounts_provider(); - let opt_accounts = Some(accounts.clone()); + let opt_accounts = accounts.clone(); let client = blockchain_client(); let miner = miner_service(); let reservations = Arc::new(Mutex::new(nonce::Reservations::new())); 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(); io.extend_with(personal.to_delegate()); diff --git a/rpc/src/v1/tests/mocked/secretstore.rs b/rpc/src/v1/tests/mocked/secretstore.rs index d3ab781bc..6ee9b6c24 100644 --- a/rpc/src/v1/tests/mocked/secretstore.rs +++ b/rpc/src/v1/tests/mocked/secretstore.rs @@ -40,7 +40,7 @@ impl Dependencies { } pub fn client(&self) -> SecretStoreClient { - SecretStoreClient::new(&Some(self.accounts.clone())) + SecretStoreClient::new(&self.accounts) } fn default_client(&self) -> IoHandler { diff --git a/rpc/src/v1/tests/mocked/signer.rs b/rpc/src/v1/tests/mocked/signer.rs index bee28b35e..8881dc41c 100644 --- a/rpc/src/v1/tests/mocked/signer.rs +++ b/rpc/src/v1/tests/mocked/signer.rs @@ -58,7 +58,7 @@ fn miner_service() -> Arc { fn signer_tester() -> SignerTester { let signer = Arc::new(SignerService::new_test(false)); let accounts = accounts_provider(); - let opt_accounts = Some(accounts.clone()); + let opt_accounts = accounts.clone(); let client = blockchain_client(); let miner = miner_service(); let reservations = Arc::new(Mutex::new(nonce::Reservations::new())); diff --git a/rpc/src/v1/tests/mocked/signing.rs b/rpc/src/v1/tests/mocked/signing.rs index 3a56c5a0d..84cf2e376 100644 --- a/rpc/src/v1/tests/mocked/signing.rs +++ b/rpc/src/v1/tests/mocked/signing.rs @@ -56,7 +56,7 @@ impl Default for SigningTester { let client = Arc::new(TestBlockChainClient::default()); let miner = Arc::new(TestMinerService::default()); 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 mut io = IoHandler::default();