Disable hardware-wallets on platforms that don't support libusb (#8464)
* disable hardware-wallets that don't support libusb * address grumbles * nits * Refactor to get rid off as much annotations asap * Might consume slight more memory than pure conditional compilation flags * formatting nits * Enable libusb for android * Tested by it compiling succesfully with `cargo build --target=armv7--linux-androideabi` * The binary is ~66 MB ```bash $ size size target/armv7-linux-androideabi/release/parity text data bss dec hex filename 50676230 416200 31456 51123886 30c16ae target/armv7-linux-androideabi/release/parity ``` * Move all `fake-hardware-wallet` to its own crate * Removes some conditional compilation flags * Introduces `fake-hardware-wallet` crate * return error if no hardware wallets are found
This commit is contained in:
committed by
Afri Schoedon
parent
4145be863b
commit
1a16f335fa
@@ -305,8 +305,8 @@ impl Parity for ParityClient {
|
||||
fn pending_transactions_stats(&self) -> Result<BTreeMap<H256, TransactionStats>> {
|
||||
let stats = self.light_dispatch.sync.transactions_stats();
|
||||
Ok(stats.into_iter()
|
||||
.map(|(hash, stats)| (hash.into(), stats.into()))
|
||||
.collect()
|
||||
.map(|(hash, stats)| (hash.into(), stats.into()))
|
||||
.collect()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ use ethcore::state::StateInfo;
|
||||
use ethcore_logger::RotatingLogger;
|
||||
use node_health::{NodeHealth, Health};
|
||||
use updater::{Service as UpdateService};
|
||||
|
||||
use jsonrpc_core::{BoxFuture, Result};
|
||||
use jsonrpc_core::futures::{future, Future};
|
||||
use jsonrpc_macros::Trailing;
|
||||
@@ -53,7 +52,7 @@ use v1::types::{
|
||||
use Host;
|
||||
|
||||
/// Parity implementation.
|
||||
pub struct ParityClient<C, M, U> {
|
||||
pub struct ParityClient<C, M, U> {
|
||||
client: Arc<C>,
|
||||
miner: Arc<M>,
|
||||
updater: Arc<U>,
|
||||
@@ -143,11 +142,11 @@ impl<C, M, U, S> Parity for ParityClient<C, M, U> where
|
||||
.collect()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
fn locked_hardware_accounts_info(&self) -> Result<Vec<String>> {
|
||||
self.accounts.locked_hardware_accounts().map_err(|e| errors::account("Error communicating with hardware wallet.", e))
|
||||
}
|
||||
|
||||
|
||||
fn default_account(&self, meta: Self::Metadata) -> Result<H160> {
|
||||
let dapp_id = meta.dapp_id();
|
||||
|
||||
@@ -312,9 +311,9 @@ impl<C, M, U, S> Parity for ParityClient<C, M, U> where
|
||||
);
|
||||
|
||||
Ok(ready_transactions
|
||||
.into_iter()
|
||||
.map(|t| Transaction::from_pending(t.pending().clone(), block_number, self.eip86_transition))
|
||||
.collect()
|
||||
.into_iter()
|
||||
.map(|t| Transaction::from_pending(t.pending().clone(), block_number, self.eip86_transition))
|
||||
.collect()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -323,9 +322,9 @@ impl<C, M, U, S> Parity for ParityClient<C, M, U> where
|
||||
let all_transactions = self.miner.queued_transactions();
|
||||
|
||||
Ok(all_transactions
|
||||
.into_iter()
|
||||
.map(|t| Transaction::from_pending(t.pending().clone(), block_number, self.eip86_transition))
|
||||
.collect()
|
||||
.into_iter()
|
||||
.map(|t| Transaction::from_pending(t.pending().clone(), block_number, self.eip86_transition))
|
||||
.collect()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -336,8 +335,8 @@ impl<C, M, U, S> Parity for ParityClient<C, M, U> where
|
||||
fn pending_transactions_stats(&self) -> Result<BTreeMap<H256, TransactionStats>> {
|
||||
let stats = self.sync.transactions_stats();
|
||||
Ok(stats.into_iter()
|
||||
.map(|(hash, stats)| (hash.into(), stats.into()))
|
||||
.collect()
|
||||
.map(|(hash, stats)| (hash.into(), stats.into()))
|
||||
.collect()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -345,9 +344,9 @@ impl<C, M, U, S> Parity for ParityClient<C, M, U> where
|
||||
let transactions = self.miner.local_transactions();
|
||||
let block_number = self.client.chain_info().best_block_number;
|
||||
Ok(transactions
|
||||
.into_iter()
|
||||
.map(|(hash, status)| (hash.into(), LocalTransactionStatus::from(status, block_number, self.eip86_transition)))
|
||||
.collect()
|
||||
.into_iter()
|
||||
.map(|(hash, status)| (hash.into(), LocalTransactionStatus::from(status, block_number, self.eip86_transition)))
|
||||
.collect()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ use ethereum_types::Address;
|
||||
use ethkey::{Brain, Generator, Secret};
|
||||
use ethstore::KeyFile;
|
||||
use ethcore::account_provider::AccountProvider;
|
||||
|
||||
use jsonrpc_core::Result;
|
||||
use v1::helpers::errors;
|
||||
use v1::traits::ParityAccounts;
|
||||
|
||||
Reference in New Issue
Block a user