U256 instead of Option<U256>. Fix up tests.

This commit is contained in:
Gav Wood
2016-06-28 10:21:29 +02:00
parent af935df553
commit 31de739122
7 changed files with 26 additions and 42 deletions

View File

@@ -22,7 +22,7 @@ use jsonrpc_core::*;
use ethcore::miner::MinerService;
use ethcore::service::SyncMessage;
use v1::traits::EthcoreSet;
use v1::types::{OptionalValue, Bytes};
use v1::types::Bytes;
/// Ethcore-specific rpc interface for operations altering the settings.
pub struct EthcoreSetClient<M> where
@@ -87,7 +87,7 @@ impl<M> EthcoreSet for EthcoreSetClient<M> where M: MinerService + 'static {
}
fn set_tx_gas_limit(&self, params: Params) -> Result<Value, Error> {
from_params::<(OptionalValue<U256>,)>(params).and_then(|(limit,)| {
from_params::<(U256,)>(params).and_then(|(limit,)| {
take_weak!(self.miner).set_tx_gas_limit(limit.into());
to_value(&true)
})

View File

@@ -29,7 +29,7 @@ use ethcore::account_provider::AccountProvider;
use devtools::RandomTempPath;
use util::Hashable;
use util::io::IoChannel;
use util::{U256, H256};
use util::{U256, H256, Uint};
use jsonrpc_core::IoHandler;
use ethjson::blockchain::BlockChain;
@@ -54,7 +54,8 @@ fn miner_service(spec: Spec, accounts: Arc<AccountProvider>) -> Arc<Miner> {
force_sealing: true,
reseal_on_external_tx: true,
reseal_on_own_tx: true,
max_tx_gas: None,
tx_queue_size: 1024,
max_tx_gas: !U256::zero(),
pending_set: PendingSet::SealingOrElseQueue,
},
spec,

View File

@@ -43,7 +43,7 @@ pub struct TestMinerService {
author: RwLock<Address>,
extra_data: RwLock<Bytes>,
limit: RwLock<usize>,
tx_gas_limit: RwLock<Option<U256>>,
tx_gas_limit: RwLock<U256>,
}
impl Default for TestMinerService {
@@ -59,7 +59,7 @@ impl Default for TestMinerService {
author: RwLock::new(Address::zero()),
extra_data: RwLock::new(vec![1, 2, 3, 4]),
limit: RwLock::new(1024),
tx_gas_limit: RwLock::new(None),
tx_gas_limit: RwLock::new(!U256::zero()),
}
}
}
@@ -101,7 +101,7 @@ impl MinerService for TestMinerService {
*self.limit.write().unwrap() = limit;
}
fn set_tx_gas_limit(&self, limit: Option<U256>) {
fn set_tx_gas_limit(&self, limit: U256) {
*self.tx_gas_limit.write().unwrap() = limit;
}