Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into refactor/hashdb-generic
Browse files Browse the repository at this point in the history
* master:
  Handle removed logs in filter changes and add geth compatibility field (#8796)
  fixed ipc leak, closes #8774 (#8876)
  scripts: remove md5 checksums (#8884)
  hardware_wallet/Ledger `Sign messages` + some refactoring (#8868)
  • Loading branch information
dvdplm committed Jun 14, 2018
2 parents 03d266d + b37b3cd commit 9ce95cd
Show file tree
Hide file tree
Showing 16 changed files with 540 additions and 287 deletions.
72 changes: 47 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 17 additions & 8 deletions ethcore/src/account_provider/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub use ethstore::{Derivation, IndexDerivation, KeyFile};
enum Unlock {
/// If account is unlocked temporarily, it should be locked after first usage.
OneTime,
/// Account unlocked permantently can always sign message.
/// Account unlocked permanently can always sign message.
/// Use with caution.
Perm,
/// Account unlocked with a timeout
Expand Down Expand Up @@ -280,10 +280,10 @@ impl AccountProvider {
pub fn accounts(&self) -> Result<Vec<Address>, Error> {
let accounts = self.sstore.accounts()?;
Ok(accounts
.into_iter()
.map(|a| a.address)
.filter(|address| !self.blacklisted_accounts.contains(address))
.collect()
.into_iter()
.map(|a| a.address)
.filter(|address| !self.blacklisted_accounts.contains(address))
.collect()
)
}

Expand Down Expand Up @@ -495,7 +495,7 @@ impl AccountProvider {
self.address_book.write().set_meta(account, meta)
}

/// Removes and address from the addressbook
/// Removes and address from the address book
pub fn remove_address(&self, addr: Address) {
self.address_book.write().remove(addr)
}
Expand Down Expand Up @@ -585,7 +585,7 @@ impl AccountProvider {
fn unlock_account(&self, address: Address, password: String, unlock: Unlock) -> Result<(), Error> {
let account = self.sstore.account_ref(&address)?;

// check if account is already unlocked pernamently, if it is, do nothing
// check if account is already unlocked permanently, if it is, do nothing
let mut unlocked = self.unlocked.write();
if let Some(data) = unlocked.get(&account) {
if let Unlock::Perm = data.unlock {
Expand Down Expand Up @@ -809,8 +809,17 @@ impl AccountProvider {
.map_err(Into::into)
}

/// Sign message with hardware wallet.
pub fn sign_message_with_hardware(&self, address: &Address, message: &[u8]) -> Result<Signature, SignError> {
match self.hardware_store.as_ref().map(|s| s.sign_message(address, message)) {
None | Some(Err(HardwareError::KeyNotFound)) => Err(SignError::NotFound),
Some(Err(e)) => Err(From::from(e)),
Some(Ok(s)) => Ok(s),
}
}

/// Sign transaction with hardware wallet.
pub fn sign_with_hardware(&self, address: Address, transaction: &Transaction, chain_id: Option<u64>, rlp_encoded_transaction: &[u8]) -> Result<Signature, SignError> {
pub fn sign_transaction_with_hardware(&self, address: &Address, transaction: &Transaction, chain_id: Option<u64>, rlp_encoded_transaction: &[u8]) -> Result<Signature, SignError> {
let t_info = TransactionInfo {
nonce: transaction.nonce,
gas_price: transaction.gas_price,
Expand Down
1 change: 1 addition & 0 deletions hw/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ libusb = { git = "https://github.com/paritytech/libusb-rs" }
trezor-sys = { git = "https://github.com/paritytech/trezor-sys" }
ethkey = { path = "../ethkey" }
ethereum-types = "0.3"
semver = "0.9"

[dev-dependencies]
rustc-hex = "1.0"
Loading

0 comments on commit 9ce95cd

Please sign in to comment.