Fixing warnings (#1321)
This commit is contained in:
parent
c1c64bedc2
commit
81df97a737
@ -229,11 +229,11 @@ impl State {
|
|||||||
// collect all the addresses which have changed.
|
// collect all the addresses which have changed.
|
||||||
let addresses = self.cache.borrow().iter().map(|(addr, _)| addr.clone()).collect::<Vec<_>>();
|
let addresses = self.cache.borrow().iter().map(|(addr, _)| addr.clone()).collect::<Vec<_>>();
|
||||||
|
|
||||||
for a in addresses.iter() {
|
for a in &addresses {
|
||||||
if self.code(a).map(|c| c.sha3() == broken_dao).unwrap_or(false) {
|
if self.code(a).map_or(false, |c| c.sha3() == broken_dao) {
|
||||||
// Figure out if the balance has been reduced.
|
// Figure out if the balance has been reduced.
|
||||||
let maybe_original = SecTrieDB::new(self.db.as_hashdb(), &self.root).expect(SEC_TRIE_DB_UNWRAP_STR).get(&a).map(Account::from_rlp);
|
let maybe_original = SecTrieDB::new(self.db.as_hashdb(), &self.root).expect(SEC_TRIE_DB_UNWRAP_STR).get(&a).map(Account::from_rlp);
|
||||||
if maybe_original.map(|original| *original.balance() > self.balance(a)).unwrap_or(false) {
|
if maybe_original.map_or(false, |original| *original.balance() > self.balance(a)) {
|
||||||
return Err(Error::Transaction(TransactionError::DAORescue));
|
return Err(Error::Transaction(TransactionError::DAORescue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,7 @@ fn can_collect_garbage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(feature="dev", allow(useless_vec))]
|
||||||
fn can_generate_gas_price_statistics() {
|
fn can_generate_gas_price_statistics() {
|
||||||
let client_result = generate_dummy_client_with_data(16, 1, &vec_into![0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
|
let client_result = generate_dummy_client_with_data(16, 1, &vec_into![0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
|
||||||
let client = client_result.reference();
|
let client = client_result.reference();
|
||||||
|
@ -140,7 +140,7 @@ pub fn create_test_block_with_data(header: &Header, transactions: &[SignedTransa
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn generate_dummy_client(block_number: u32) -> GuardedTempResult<Arc<Client>> {
|
pub fn generate_dummy_client(block_number: u32) -> GuardedTempResult<Arc<Client>> {
|
||||||
generate_dummy_client_with_spec_and_data(Spec::new_test, block_number, 0, &(vec![]))
|
generate_dummy_client_with_spec_and_data(Spec::new_test, block_number, 0, &[])
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn generate_dummy_client_with_data(block_number: u32, txs_per_block: usize, tx_gas_prices: &[U256]) -> GuardedTempResult<Arc<Client>> {
|
pub fn generate_dummy_client_with_data(block_number: u32, txs_per_block: usize, tx_gas_prices: &[U256]) -> GuardedTempResult<Arc<Client>> {
|
||||||
|
@ -1170,7 +1170,7 @@ impl ChainSync {
|
|||||||
.expect("chain.tree_route and chain.find_uncles only return hahses of blocks that are in the blockchain. qed.")).number();
|
.expect("chain.tree_route and chain.find_uncles only return hahses of blocks that are in the blockchain. qed.")).number();
|
||||||
hash_rlp.append(&block_hash);
|
hash_rlp.append(&block_hash);
|
||||||
hash_rlp.append(&number);
|
hash_rlp.append(&number);
|
||||||
rlp_stream.append_raw(&hash_rlp.as_raw(), 1);
|
rlp_stream.append_raw(hash_rlp.as_raw(), 1);
|
||||||
}
|
}
|
||||||
Some(rlp_stream.out())
|
Some(rlp_stream.out())
|
||||||
}
|
}
|
||||||
|
@ -124,12 +124,11 @@ impl EthSync {
|
|||||||
/// Creates and register protocol with the network service
|
/// Creates and register protocol with the network service
|
||||||
pub fn new(config: SyncConfig, chain: Arc<Client>) -> Arc<EthSync> {
|
pub fn new(config: SyncConfig, chain: Arc<Client>) -> Arc<EthSync> {
|
||||||
let sync = ChainSync::new(config, chain.deref());
|
let sync = ChainSync::new(config, chain.deref());
|
||||||
let sync = Arc::new(EthSync {
|
Arc::new(EthSync {
|
||||||
chain: chain,
|
chain: chain,
|
||||||
sync: RwLock::new(sync),
|
sync: RwLock::new(sync),
|
||||||
io_channel: RwLock::new(IoChannel::disconnected()),
|
io_channel: RwLock::new(IoChannel::disconnected()),
|
||||||
});
|
})
|
||||||
sync
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Register protocol with the network service
|
/// Register protocol with the network service
|
||||||
|
@ -252,7 +252,7 @@ impl<'s, Message> NetworkContext<'s, Message> where Message: Send + Sync + Clone
|
|||||||
|
|
||||||
/// Check if the session is still active.
|
/// Check if the session is still active.
|
||||||
pub fn is_expired(&self) -> bool {
|
pub fn is_expired(&self) -> bool {
|
||||||
self.session.as_ref().map(|s| s.lock().unwrap().expired()).unwrap_or(false)
|
self.session.as_ref().map_or(false, |s| s.lock().unwrap().expired())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Register a new IO timer. 'IoHandler::timeout' will be called with the token.
|
/// Register a new IO timer. 'IoHandler::timeout' will be called with the token.
|
||||||
|
Loading…
Reference in New Issue
Block a user