Fixing warnings (#1705)
This commit is contained in:
parent
e734810293
commit
f048839a4b
@ -30,7 +30,7 @@ use blockchain::best_block::BestBlock;
|
|||||||
use types::tree_route::TreeRoute;
|
use types::tree_route::TreeRoute;
|
||||||
use blockchain::update::ExtrasUpdate;
|
use blockchain::update::ExtrasUpdate;
|
||||||
use blockchain::{CacheSize, ImportRoute, Config};
|
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_LEVELS: usize = 3;
|
||||||
const LOG_BLOOMS_ELEMENTS_PER_INDEX: usize = 16;
|
const LOG_BLOOMS_ELEMENTS_PER_INDEX: usize = 16;
|
||||||
@ -296,7 +296,7 @@ impl BlockChain {
|
|||||||
// load best block
|
// load best block
|
||||||
let best_block_hash = match bc.extras_db.get(b"best").unwrap() {
|
let best_block_hash = match bc.extras_db.get(b"best").unwrap() {
|
||||||
Some(best) => {
|
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() {
|
if !bc.blocks_db.get(&new_best).unwrap().is_some() {
|
||||||
warn!("Best block {} not found", new_best.hex());
|
warn!("Best block {} not found", new_best.hex());
|
||||||
}
|
}
|
||||||
@ -358,7 +358,9 @@ impl BlockChain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Rewind to a previous block
|
/// Rewind to a previous block
|
||||||
pub fn rewind(&self) -> Option<H256> {
|
#[cfg(test)]
|
||||||
|
fn rewind(&self) -> Option<H256> {
|
||||||
|
use db::Key;
|
||||||
let batch = DBTransaction::new();
|
let batch = DBTransaction::new();
|
||||||
// track back to the best block we have in the blocks database
|
// 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() {
|
if let Some(best_block_hash) = self.extras_db.get(b"best").unwrap() {
|
||||||
|
@ -23,7 +23,7 @@ use bloomchain::{Number, Config as BloomConfig};
|
|||||||
use bloomchain::group::{BloomGroupDatabase, BloomGroupChain, GroupPosition, BloomGroup};
|
use bloomchain::group::{BloomGroupDatabase, BloomGroupChain, GroupPosition, BloomGroup};
|
||||||
use util::{H256, H264, Database, DatabaseConfig, DBTransaction, RwLock};
|
use util::{H256, H264, Database, DatabaseConfig, DBTransaction, RwLock};
|
||||||
use header::BlockNumber;
|
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 db::{Key, Writable, Readable, CacheUpdatePolicy};
|
||||||
use blooms;
|
use blooms;
|
||||||
use super::flat::{FlatTrace, FlatBlockTraces, FlatTransactionTraces};
|
use super::flat::{FlatTrace, FlatBlockTraces, FlatTransactionTraces};
|
||||||
|
@ -74,6 +74,7 @@ impl Decodable for FlatTrace {
|
|||||||
pub struct FlatTransactionTraces(Vec<FlatTrace>);
|
pub struct FlatTransactionTraces(Vec<FlatTrace>);
|
||||||
|
|
||||||
impl FlatTransactionTraces {
|
impl FlatTransactionTraces {
|
||||||
|
/// Returns bloom of all traces in the collection.
|
||||||
pub fn bloom(&self) -> LogBloom {
|
pub fn bloom(&self) -> LogBloom {
|
||||||
self.0.iter().fold(Default::default(), | bloom, trace | bloom | trace.bloom())
|
self.0.iter().fold(Default::default(), | bloom, trace | bloom | trace.bloom())
|
||||||
}
|
}
|
||||||
@ -102,6 +103,7 @@ impl Into<Vec<FlatTrace>> for FlatTransactionTraces {
|
|||||||
pub struct FlatBlockTraces(Vec<FlatTransactionTraces>);
|
pub struct FlatBlockTraces(Vec<FlatTransactionTraces>);
|
||||||
|
|
||||||
impl FlatBlockTraces {
|
impl FlatBlockTraces {
|
||||||
|
/// Returns bloom of all traces in the block.
|
||||||
pub fn bloom(&self) -> LogBloom {
|
pub fn bloom(&self) -> LogBloom {
|
||||||
self.0.iter().fold(Default::default(), | bloom, tx_traces | bloom | tx_traces.bloom())
|
self.0.iter().fold(Default::default(), | bloom, tx_traces | bloom | tx_traces.bloom())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user