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

Commit

Permalink
fix(cleanup)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasad1 committed Jan 19, 2019
1 parent fe9acb9 commit c1a46de
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 17 deletions.
1 change: 0 additions & 1 deletion rpc/src/v1/helpers/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,6 @@ pub fn execute<D: Dispatcher + 'static>(
let res = signature(&accounts, address, data, pass)
.map(|result| result
.map(|rsv| H520(rsv.into_electrum()))
// .map(RpcH520::from)
.map(ConfirmationResponse::Signature)
);
Box::new(future::done(res))
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/v1/helpers/subscribers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use ethereum_types::H64;
use jsonrpc_macros::pubsub::{Subscriber, Sink, SubscriptionId};
use rand::{Rng, StdRng};

// FIXME: This type is needless use `serde_json::to_string` instead
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
pub struct Id(H64);
impl str::FromStr for Id {
Expand All @@ -38,6 +37,7 @@ impl str::FromStr for Id {
}
}
impl Id {
// FIXME: [niklasad1] replace `format` with `serde_json::to_string_pretty`
pub fn as_string(&self) -> String {
format!("{:?}", self.0)
}
Expand Down
3 changes: 0 additions & 3 deletions rpc/src/v1/helpers/work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ use v1::helpers::errors;
// Submit a POW work and return the block's hash
pub fn submit_work_detail<C: BlockChainClient, M: MinerService>(client: &Arc<C>, miner: &Arc<M>, nonce: H64, pow_hash: H256, mix_hash: H256) -> Result<H256, Error> {
// TODO [ToDr] Should disallow submissions in case of PoA?
let nonce: H64 = nonce.into();
let pow_hash: H256 = pow_hash.into();
let mix_hash: H256 = mix_hash.into();
trace!(target: "miner", "submit_work_detail: Decoded: nonce={}, pow_hash={}, mix_hash={}", nonce, pow_hash, mix_hash);
let seal = vec![rlp::encode(&mix_hash), rlp::encode(&nonce)];
let import = miner.submit_seal(pow_hash, seal)
Expand Down
16 changes: 4 additions & 12 deletions rpc/src/v1/impls/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,6 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> Eth for EthClient<
}

fn balance(&self, address: H160, num: Trailing<BlockNumber>) -> BoxFuture<U256> {
let address = address.into();

let num = num.unwrap_or_default();

try_bf!(check_known(&*self.client, num.clone()));
Expand All @@ -584,8 +582,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> Eth for EthClient<
fn proof(&self, address: H160, values: Vec<H256>, num: Trailing<BlockNumber>) -> BoxFuture<EthAccount> {
try_bf!(errors::require_experimental(self.options.allow_experimental_rpcs, "1186"));

let a: H160 = address.clone().into();
let key1 = keccak(a);
let key1 = keccak(address);

let num = num.unwrap_or_default();
let id = match num {
Expand Down Expand Up @@ -624,10 +621,8 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> Eth for EthClient<
Box::new(future::done(res))
}

fn storage_at(&self, address: H160, pos: U256, num: Trailing<BlockNumber>) -> BoxFuture<H256> {
let address: Address = H160::into(address);
let position: U256 = U256::into(pos);

fn storage_at(&self, address: H160, position: U256, num: Trailing<BlockNumber>) -> BoxFuture<H256> {
let address: Address = address.into();
let num = num.unwrap_or_default();

try_bf!(check_known(&*self.client, num.clone()));
Expand All @@ -640,7 +635,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> Eth for EthClient<
}

fn transaction_count(&self, address: H160, num: Trailing<BlockNumber>) -> BoxFuture<U256> {
let address: Address = H160::into(address);
let address: Address = address.into();

let res = match num.unwrap_or_default() {
BlockNumber::Pending if self.options.pending_nonce_from_queue => {
Expand Down Expand Up @@ -749,7 +744,6 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> Eth for EthClient<
}

fn transaction_by_hash(&self, hash: H256) -> BoxFuture<Option<Transaction>> {
let hash: H256 = hash.into();
let tx = try_bf!(self.transaction(PendingTransactionId::Hash(hash))).or_else(|| {
self.miner.transaction(&hash)
.map(|t| Transaction::from_pending(t.pending().clone()))
Expand Down Expand Up @@ -781,8 +775,6 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> Eth for EthClient<
}

fn transaction_receipt(&self, hash: H256) -> BoxFuture<Option<Receipt>> {
let hash: H256 = hash.into();

if self.options.allow_pending_receipt_query {
let best_block = self.client.chain_info().best_block_number;
if let Some(receipt) = self.miner.pending_receipt(best_block, &hash) {
Expand Down

0 comments on commit c1a46de

Please sign in to comment.