Merge pull request #3800 from ethcore/eth-sign

eth_sign RPC now hashes given data instead of getting the hash
This commit is contained in:
Gav Wood
2016-12-12 04:12:27 +01:00
committed by GitHub
5 changed files with 17 additions and 14 deletions

View File

@@ -18,7 +18,7 @@
use std::sync::{Arc, Weak};
use transient_hashmap::TransientHashMap;
use util::{U256, Mutex};
use util::{U256, Mutex, Hashable};
use ethcore::account_provider::AccountProvider;
use ethcore::miner::MinerService;
@@ -180,7 +180,8 @@ impl<C: 'static, M: 'static> EthSigning for SigningQueueClient<C, M> where
C: MiningBlockChainClient,
M: MinerService,
{
fn sign(&self, ready: Ready<RpcH520>, address: RpcH160, hash: RpcH256) {
fn sign(&self, ready: Ready<RpcH520>, address: RpcH160, data: RpcBytes) {
let hash = data.0.sha3().into();
let res = self.active().and_then(|_| self.dispatch(RpcConfirmationPayload::Signature((address, hash).into())));
self.handle_dispatch(res, |response| {
match response {

View File

@@ -17,6 +17,7 @@
//! Unsafe Signing RPC implementation.
use std::sync::{Arc, Weak};
use util::Hashable;
use ethcore::account_provider::AccountProvider;
use ethcore::miner::MinerService;
@@ -83,7 +84,8 @@ impl<C: 'static, M: 'static> EthSigning for SigningUnsafeClient<C, M> where
C: MiningBlockChainClient,
M: MinerService,
{
fn sign(&self, ready: Ready<RpcH520>, address: RpcH160, hash: RpcH256) {
fn sign(&self, ready: Ready<RpcH520>, address: RpcH160, data: RpcBytes) {
let hash = data.0.sha3().into();
let result = match self.handle(RpcConfirmationPayload::Signature((address, hash).into())) {
Ok(RpcConfirmationResponse::Signature(signature)) => Ok(signature),
Err(e) => Err(e),