From f048839a4bbba69ed29275ba713bee3f25e4fbce Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Mon, 25 Jul 2016 10:21:02 +0200 Subject: [PATCH] Fixing warnings (#1705) --- ethcore/src/blockchain/blockchain.rs | 8 +++++--- ethcore/src/trace/db.rs | 2 +- ethcore/src/trace/flat.rs | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ethcore/src/blockchain/blockchain.rs b/ethcore/src/blockchain/blockchain.rs index f7e0a29fa..c26b91766 100644 --- a/ethcore/src/blockchain/blockchain.rs +++ b/ethcore/src/blockchain/blockchain.rs @@ -30,7 +30,7 @@ use blockchain::best_block::BestBlock; use types::tree_route::TreeRoute; use blockchain::update::ExtrasUpdate; use blockchain::{CacheSize, ImportRoute, Config}; -use db::{Writable, Readable, CacheUpdatePolicy, Key}; +use db::{Writable, Readable, CacheUpdatePolicy}; const LOG_BLOOMS_LEVELS: usize = 3; const LOG_BLOOMS_ELEMENTS_PER_INDEX: usize = 16; @@ -296,7 +296,7 @@ impl BlockChain { // load best block let best_block_hash = match bc.extras_db.get(b"best").unwrap() { Some(best) => { - let mut new_best = H256::from_slice(&best); + let new_best = H256::from_slice(&best); if !bc.blocks_db.get(&new_best).unwrap().is_some() { warn!("Best block {} not found", new_best.hex()); } @@ -358,7 +358,9 @@ impl BlockChain { } /// Rewind to a previous block - pub fn rewind(&self) -> Option { + #[cfg(test)] + fn rewind(&self) -> Option { + use db::Key; let batch = DBTransaction::new(); // track back to the best block we have in the blocks database if let Some(best_block_hash) = self.extras_db.get(b"best").unwrap() { diff --git a/ethcore/src/trace/db.rs b/ethcore/src/trace/db.rs index 097fc22a6..edd7dd189 100644 --- a/ethcore/src/trace/db.rs +++ b/ethcore/src/trace/db.rs @@ -23,7 +23,7 @@ use bloomchain::{Number, Config as BloomConfig}; use bloomchain::group::{BloomGroupDatabase, BloomGroupChain, GroupPosition, BloomGroup}; use util::{H256, H264, Database, DatabaseConfig, DBTransaction, RwLock}; use header::BlockNumber; -use trace::{BlockTraces, LocalizedTrace, Config, Switch, Filter, Database as TraceDatabase, ImportRequest, DatabaseExtras, Error}; +use trace::{LocalizedTrace, Config, Switch, Filter, Database as TraceDatabase, ImportRequest, DatabaseExtras, Error}; use db::{Key, Writable, Readable, CacheUpdatePolicy}; use blooms; use super::flat::{FlatTrace, FlatBlockTraces, FlatTransactionTraces}; diff --git a/ethcore/src/trace/flat.rs b/ethcore/src/trace/flat.rs index f39af4423..1e39e940c 100644 --- a/ethcore/src/trace/flat.rs +++ b/ethcore/src/trace/flat.rs @@ -74,6 +74,7 @@ impl Decodable for FlatTrace { pub struct FlatTransactionTraces(Vec); impl FlatTransactionTraces { + /// Returns bloom of all traces in the collection. pub fn bloom(&self) -> LogBloom { self.0.iter().fold(Default::default(), | bloom, trace | bloom | trace.bloom()) } @@ -102,6 +103,7 @@ impl Into> for FlatTransactionTraces { pub struct FlatBlockTraces(Vec); impl FlatBlockTraces { + /// Returns bloom of all traces in the block. pub fn bloom(&self) -> LogBloom { self.0.iter().fold(Default::default(), | bloom, tx_traces | bloom | tx_traces.bloom()) }