Fixing warnings (#1321)
This commit is contained in:
@@ -229,11 +229,11 @@ impl State {
|
||||
// collect all the addresses which have changed.
|
||||
let addresses = self.cache.borrow().iter().map(|(addr, _)| addr.clone()).collect::<Vec<_>>();
|
||||
|
||||
for a in addresses.iter() {
|
||||
if self.code(a).map(|c| c.sha3() == broken_dao).unwrap_or(false) {
|
||||
for a in &addresses {
|
||||
if self.code(a).map_or(false, |c| c.sha3() == broken_dao) {
|
||||
// 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);
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,6 +113,7 @@ fn can_collect_garbage() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(feature="dev", allow(useless_vec))]
|
||||
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 = 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>> {
|
||||
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>> {
|
||||
@@ -205,7 +205,7 @@ pub fn generate_dummy_client_with_spec_and_data<F>(get_test_spec: F, block_numbe
|
||||
if let Err(e) = client.import_block(b.rlp_bytes()) {
|
||||
panic!("error importing block which is valid by definition: {:?}", e);
|
||||
}
|
||||
|
||||
|
||||
last_header = BlockView::new(&b.rlp_bytes()).header();
|
||||
db = b.drain();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user