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
@@ -24,7 +24,6 @@ use light::cache::Cache as LightDataCache;
|
||||
use light::client::LightChainClient;
|
||||
use light::on_demand::{request, OnDemand};
|
||||
use light::TransactionQueue as LightTransactionQueue;
|
||||
use rlp;
|
||||
use hash::keccak;
|
||||
use ethereum_types::{H256, H520, Address, U256};
|
||||
use bytes::Bytes;
|
||||
@@ -52,6 +51,7 @@ use v1::types::{
|
||||
SignRequest as RpcSignRequest,
|
||||
DecryptRequest as RpcDecryptRequest,
|
||||
};
|
||||
use rlp;
|
||||
|
||||
pub use self::nonce::Reservations;
|
||||
|
||||
@@ -323,7 +323,7 @@ impl LightDispatcher {
|
||||
x.map(move |acc| acc.map_or(account_start_nonce, |acc| acc.nonce))
|
||||
.map_err(|_| errors::no_light_peers())
|
||||
),
|
||||
None => Box::new(future::err(errors::network_disabled()))
|
||||
None => Box::new(future::err(errors::network_disabled()))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -699,7 +699,6 @@ pub fn execute<D: Dispatcher + 'static>(
|
||||
if accounts.is_hardware_address(&address) {
|
||||
return Box::new(future::err(errors::unsupported("Decrypting via hardware wallets is not supported.", None)));
|
||||
}
|
||||
|
||||
let res = decrypt(&accounts, address, data, pass)
|
||||
.map(|result| result
|
||||
.map(RpcBytes)
|
||||
@@ -737,8 +736,8 @@ fn hardware_signature(accounts: &AccountProvider, address: Address, t: Transacti
|
||||
|
||||
SignedTransaction::new(t.with_signature(signature, chain_id))
|
||||
.map_err(|e| {
|
||||
debug!(target: "miner", "Hardware wallet has produced invalid signature: {}", e);
|
||||
errors::account("Invalid signature generated", e)
|
||||
debug!(target: "miner", "Hardware wallet has produced invalid signature: {}", e);
|
||||
errors::account("Invalid signature generated", e)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user