RPC for deleting accounts.

This commit is contained in:
Gav Wood
2016-11-20 16:17:57 +01:00
parent 9832be395f
commit 2b8bed434c
3 changed files with 23 additions and 3 deletions

View File

@@ -104,7 +104,7 @@ impl<C: 'static> ParityAccounts for ParityAccountsClient<C> where C: MiningBlock
let account: Address = account.into();
take_weak!(self.accounts)
.test_password(&account, password)
.test_password(&account, &password)
.map_err(|e| errors::account("Could not fetch account info.", e))
}
@@ -117,6 +117,15 @@ impl<C: 'static> ParityAccounts for ParityAccountsClient<C> where C: MiningBlock
.map_err(|e| errors::account("Could not fetch account info.", e))
}
fn kill_account(&self, account: RpcH160, password: String) -> Result<bool, Error> {
try!(self.active());
let account: Address = account.into();
take_weak!(self.accounts)
.kill_account(&account, &password)
.map(|_| true)
.map_err(|e| errors::account("Could not fetch account info.", e))
}
fn set_account_name(&self, addr: RpcH160, name: String) -> Result<bool, Error> {
try!(self.active());
let store = take_weak!(self.accounts);

View File

@@ -53,6 +53,11 @@ build_rpc_trait! {
#[rpc(name = "parity_changePassword")]
fn change_password(&self, H160, String, String) -> Result<bool, Error>;
/// Permanently deletes an account.
/// Arguments: `account`, `password`.
#[rpc(name = "parity_killAccount")]
fn kill_account(&self, H160, String) -> Result<bool, Error>;
/// Set an account's name.
#[rpc(name = "parity_setAccountName")]
fn set_account_name(&self, H160, String) -> Result<bool, Error>;