Deprecate account management (#10213)
* Extract accounts from ethcore. * Fix ethcore. * Get rid of AccountProvider in test_helpers * Fix rest of the code. * Re-use EngineSigner, fix tests. * Simplify EngineSigner to always have an Address. * Fix RPC tests. * Add deprecation notice to RPCs. * Feature to disable accounts. * extract accounts in RPC * Run with accounts in tests. * Fix RPC compilation and tests. * Fix compilation of the binary. * Fix compilation of the binary. * Fix compilation with accounts enabled. * Fix tests. * Update submodule. * Remove android. * Use derive for Default * Don't build secretstore by default. * Add link to issue. * Refresh Cargo.lock. * Fix miner tests. * Update rpc/Cargo.toml Co-Authored-By: tomusdrw <tomusdrw@users.noreply.github.com> * Fix private tests.
This commit is contained in:
committed by
Afri Schoedon
parent
8fa56add47
commit
d5c19f8719
@@ -57,6 +57,7 @@ pub mod external;
|
||||
#[cfg(feature = "price-info")]
|
||||
pub mod gas_price_calibrator;
|
||||
pub mod gas_pricer;
|
||||
pub mod local_accounts;
|
||||
pub mod pool;
|
||||
pub mod service_transaction_checker;
|
||||
#[cfg(feature = "work-notify")]
|
||||
|
||||
43
miner/src/local_accounts.rs
Normal file
43
miner/src/local_accounts.rs
Normal file
@@ -0,0 +1,43 @@
|
||||
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity Ethereum.
|
||||
|
||||
// Parity Ethereum 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 Ethereum 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 Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Local Accounts checker
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
use ethereum_types::Address;
|
||||
|
||||
/// Local accounts checker
|
||||
pub trait LocalAccounts: Send + Sync {
|
||||
/// Returns true if given address should be considered local account.
|
||||
fn is_local(&self, &Address) -> bool;
|
||||
}
|
||||
|
||||
impl LocalAccounts for HashSet<Address> {
|
||||
fn is_local(&self, address: &Address) -> bool {
|
||||
self.contains(address)
|
||||
}
|
||||
}
|
||||
|
||||
impl<A, B> LocalAccounts for (A, B) where
|
||||
A: LocalAccounts,
|
||||
B: LocalAccounts,
|
||||
{
|
||||
fn is_local(&self, address: &Address) -> bool {
|
||||
self.0.is_local(address) || self.1.is_local(address)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user