removed all warnings

This commit is contained in:
debris 2015-12-14 17:53:48 +01:00
parent b7ed6144db
commit e38225d1a5
6 changed files with 24 additions and 28 deletions

View File

@ -1,5 +1,4 @@
use util::hash::*; use util::hash::*;
use util::hashdb::*;
use util::overlaydb::*; use util::overlaydb::*;
use util::rlp::*; use util::rlp::*;
use util::sha3::*; use util::sha3::*;
@ -56,12 +55,12 @@ pub struct Block {
impl Block { impl Block {
/// Creates block with empty state root /// Creates block with empty state root
pub fn new(db: OverlayDB) -> Block { pub fn new(_db: OverlayDB) -> Block {
unimplemented!() unimplemented!()
} }
/// Creates block with state root /// Creates block with state root
pub fn new_existing(db: OverlayDB, state_root: H256) -> Block { pub fn new_existing(_db: OverlayDB, _state_root: H256) -> Block {
unimplemented!() unimplemented!()
} }

View File

@ -23,9 +23,9 @@ pub struct BlockChain {
// rlp list of 3 // rlp list of 3
genesis_block: Bytes, genesis_block: Bytes,
// genesis block header // genesis block header
genesis_header: Bytes, _genesis_header: Bytes,
genesis_hash: H256, genesis_hash: H256,
genesis_state: HashMap<Address, Account>, _genesis_state: HashMap<Address, Account>,
last_block_number: U256, last_block_number: U256,
@ -37,7 +37,7 @@ pub struct BlockChain {
block_hashes: Extras<U256, H256>, block_hashes: Extras<U256, H256>,
transaction_addresses: Extras<H256, TransactionAddress>, transaction_addresses: Extras<H256, TransactionAddress>,
block_logs: Extras<H256, BlockLogBlooms>, block_logs: Extras<H256, BlockLogBlooms>,
blocks_blooms: Extras<H256, BlocksBlooms>, _blocks_blooms: Extras<H256, BlocksBlooms>,
extras_db: DB, extras_db: DB,
blocks_db: DB blocks_db: DB
@ -90,26 +90,26 @@ impl BlockChain {
let blocks_db = DB::open_default(blocks_path.to_str().unwrap()).unwrap(); let blocks_db = DB::open_default(blocks_path.to_str().unwrap()).unwrap();
{ {
let mut batch = WriteBatch::new(); let batch = WriteBatch::new();
batch.put(&genesis_hash.to_extras_slice(ExtrasIndex::BlockDetails), &encode(&genesis_details)); batch.put(&genesis_hash.to_extras_slice(ExtrasIndex::BlockDetails), &encode(&genesis_details)).unwrap();
batch.put(&U256::from(0u8).to_extras_slice(ExtrasIndex::BlockHash), &encode(&genesis_hash)); batch.put(&U256::from(0u8).to_extras_slice(ExtrasIndex::BlockHash), &encode(&genesis_hash)).unwrap();
extras_db.write(batch); extras_db.write(batch).unwrap();
blocks_db.put(&genesis_hash, &genesis_block); blocks_db.put(&genesis_hash, &genesis_block).unwrap();
} }
BlockChain { BlockChain {
genesis_block: genesis_block, genesis_block: genesis_block,
genesis_header: genesis_header, _genesis_header: genesis_header,
genesis_hash: genesis_hash, genesis_hash: genesis_hash,
genesis_state: genesis_state, _genesis_state: genesis_state,
last_block_number: U256::from(0u8), last_block_number: U256::from(0u8),
blocks: RwLock::new(HashMap::new()), blocks: RwLock::new(HashMap::new()),
block_details: Extras::new(ExtrasIndex::BlockDetails), block_details: Extras::new(ExtrasIndex::BlockDetails),
block_hashes: Extras::new(ExtrasIndex::BlockHash), block_hashes: Extras::new(ExtrasIndex::BlockHash),
transaction_addresses: Extras::new(ExtrasIndex::TransactionAddress), transaction_addresses: Extras::new(ExtrasIndex::TransactionAddress),
block_logs: Extras::new(ExtrasIndex::BlockLogBlooms), block_logs: Extras::new(ExtrasIndex::BlockLogBlooms),
blocks_blooms: Extras::new(ExtrasIndex::BlocksBlooms), _blocks_blooms: Extras::new(ExtrasIndex::BlocksBlooms),
extras_db: extras_db, extras_db: extras_db,
blocks_db: blocks_db blocks_db: blocks_db
} }
@ -122,10 +122,10 @@ impl BlockChain {
return Block::new_existing(db.clone(), root) return Block::new_existing(db.clone(), root)
} }
let mut block = Block::new(db.clone()); let block = Block::new(db.clone());
// TODO: commit // TODO: commit
//block.mutable_state().insert_accounts(&self.genesis_state); //block.mutable_state().insert_accounts(&self.genesis_state);
block.mutable_state().db().commit(); // block.mutable_state().db().commit();
// TODO: set previous block // TODO: set previous block
// TODO: reset current // TODO: reset current
block block
@ -136,7 +136,7 @@ impl BlockChain {
VerifiedBlock::new(block) VerifiedBlock::new(block)
} }
pub fn import_block(&self, block: &[u8], db: &OverlayDB) -> ImportRoute { pub fn import_block(&self, block: &[u8], _db: &OverlayDB) -> ImportRoute {
let view = HeaderView::new(block); let view = HeaderView::new(block);
// check if we already know this block // check if we already know this block

View File

@ -157,6 +157,4 @@ impl Encodable for Header {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
fn encoding_and_decoding() {
}
} }

View File

@ -104,7 +104,6 @@ impl Genesis {
#[test] #[test]
fn test_genesis() { fn test_genesis() {
use block::*; use block::*;
use blockheader::*;
let g = Genesis::new_frontier(); let g = Genesis::new_frontier();
let view = BlockView::new(&g.block).header_view(); let view = BlockView::new(&g.block).header_view();

View File

@ -2,7 +2,7 @@ use util::hash::*;
use transaction::*; use transaction::*;
pub struct ImportRoute { pub struct ImportRoute {
dead_blocks: Vec<H256>, _dead_blocks: Vec<H256>,
live_blocks: Vec<H256>, _live_blocks: Vec<H256>,
transactions: Vec<Transaction> _transactions: Vec<Transaction>
} }

View File

@ -2,16 +2,16 @@ use blockheader::*;
use transaction::*; use transaction::*;
pub struct VerifiedBlock<'a> { pub struct VerifiedBlock<'a> {
blockview: HeaderView<'a>, _blockview: HeaderView<'a>,
transactions: Vec<Transaction> _transactions: Vec<Transaction>
} }
impl<'a> VerifiedBlock<'a> { impl<'a> VerifiedBlock<'a> {
// todo, new should also take transactions // todo, new should also take transactions
pub fn new(bytes: &'a [u8]) -> VerifiedBlock<'a> { pub fn new(bytes: &'a [u8]) -> VerifiedBlock<'a> {
VerifiedBlock { VerifiedBlock {
blockview: HeaderView::new(bytes), _blockview: HeaderView::new(bytes),
transactions: vec![] _transactions: vec![]
} }
} }
} }