diff --git a/ethcore/src/block.rs b/ethcore/src/block.rs index eb9d66124..582b8669a 100644 --- a/ethcore/src/block.rs +++ b/ethcore/src/block.rs @@ -404,7 +404,7 @@ mod tests { let mut db_result = get_temp_journal_db(); let mut db = db_result.take(); engine.spec().ensure_db_good(&mut db); - let b = OpenBlock::new(engine.deref(), db, &genesis_header, vec![genesis_header.hash()], Address::zero(), vec![]).close().seal(vec![]).unwrap(); + let b = OpenBlock::new(engine.deref(), db, &genesis_header, vec![genesis_header.hash()], Address::zero(), vec![]).close().seal(&engine, vec![]).unwrap(); let orig_bytes = b.rlp_bytes(); let orig_db = b.drain(); diff --git a/ethcore/src/block_queue.rs b/ethcore/src/block_queue.rs index 143f53647..490a17995 100644 --- a/ethcore/src/block_queue.rs +++ b/ethcore/src/block_queue.rs @@ -455,7 +455,7 @@ mod tests { match duplicate_import { Err(e) => { match e { - ImportError::AlreadyQueued => {}, + Error::Import(ImportError::AlreadyQueued) => {}, _ => { panic!("must return AlreadyQueued error"); } } } diff --git a/ethcore/src/blockchain/blockchain.rs b/ethcore/src/blockchain/blockchain.rs index 0aba36a8e..88a6504ac 100644 --- a/ethcore/src/blockchain/blockchain.rs +++ b/ethcore/src/blockchain/blockchain.rs @@ -473,6 +473,12 @@ impl BlockChain { self.extras_db.write(batch).unwrap(); } + /// Given a block's `parent`, find every block header which represents a valid uncle. + pub fn find_uncle_headers(&self, _parent: &H256) -> Vec
{ + // TODO + Vec::new() + } + /// Get inserted block info which is critical to preapre extras updates. fn block_info(&self, block_bytes: &[u8]) -> BlockInfo { let block = BlockView::new(block_bytes); diff --git a/ethcore/src/client.rs b/ethcore/src/client.rs index e5d9f8fcf..4b109c8a3 100644 --- a/ethcore/src/client.rs +++ b/ethcore/src/client.rs @@ -418,7 +418,7 @@ impl Client { } } - /// Set the author that we will seal blocks as. + /// Get the author that we will seal blocks as. pub fn author(&self) -> Address { self.author.read().unwrap().clone() } @@ -428,7 +428,7 @@ impl Client { *self.author.write().unwrap() = author; } - /// Set the extra_data that we will seal blocks wuth. + /// Get the extra_data that we will seal blocks wuth. pub fn extra_data(&self) -> Bytes { self.extra_data.read().unwrap().clone() } @@ -441,16 +441,19 @@ impl Client { /// New chain head event. Restart mining operation. pub fn prepare_sealing(&self) { let h = self.chain.read().unwrap().best_block_hash(); - let b = OpenBlock::new( + let mut b = OpenBlock::new( self.engine.deref().deref(), self.state_db.lock().unwrap().clone(), match self.chain.read().unwrap().block_header(&h) { Some(ref x) => x, None => {return;} }, - self.build_last_hashes(h), + self.build_last_hashes(h.clone()), self.author(), self.extra_data() ); - // TODO: push uncles. + + self.chain.read().unwrap().find_uncle_headers(&h).into_iter().foreach(|h| { b.push_uncle(h).unwrap(); }); + // TODO: push transactions. + let b = b.close(); trace!("Sealing: number={}, hash={}, diff={}", b.hash(), b.block().header().difficulty(), b.block().header().number()); *self.sealing_block.lock().unwrap() = Some(b); diff --git a/util/src/misc.rs b/util/src/misc.rs index d9f52fd71..6cd506d02 100644 --- a/util/src/misc.rs +++ b/util/src/misc.rs @@ -82,7 +82,7 @@ pub fn version_data() -> Bytes { u32::from_str(env!("CARGO_PKG_VERSION_PATCH")).unwrap(); s.append(&v); s.append(&"Parity"); - s.append(&format!("rustc{}", rustc_version::version())); - s.append(&Target::os()); + s.append(&format!("{}", rustc_version::version())); + s.append(&&Target::os()[0..2]); s.out() } \ No newline at end of file