Signer with Unlocked Account (#1398)

This commit is contained in:
Tomasz Drwięga
2016-06-22 21:32:26 +02:00
committed by Gav Wood
parent e346cbc7f9
commit 9a1e1b7c89
5 changed files with 72 additions and 5 deletions

View File

@@ -205,6 +205,13 @@ impl AccountProvider {
self.unlock_account(account, password, Unlock::Temp)
}
/// Checks if given account is unlocked
pub fn is_unlocked<A>(&self, account: A) -> bool where Address: From<A> {
let account = Address::from(account).into();
let unlocked = self.unlocked.read().unwrap();
unlocked.get(&account).is_some()
}
/// Signs the message. Account must be unlocked.
pub fn sign<A, M>(&self, account: A, message: M) -> Result<H520, Error> where Address: From<A>, Message: From<M> {
let account = Address::from(account).into();