Fixed tests and tweaked sync progress report

This commit is contained in:
arkpar
2016-01-22 15:58:52 +01:00
parent e5e0d3d136
commit b5f0a41265
4 changed files with 15 additions and 8 deletions

View File

@@ -17,7 +17,7 @@
/// fn main() {
/// let mut service = NetworkService::start().unwrap();
/// let dir = env::temp_dir();
/// let client = Arc::new(Client::new(ethereum::new_frontier(), &dir).unwrap());
/// let client = Client::new(ethereum::new_frontier(), &dir, service.io().channel()).unwrap();
/// EthSync::register(&mut service, client);
/// }
/// ```

View File

@@ -131,7 +131,8 @@ impl BlockChainClient for TestBlockChainClient {
}
}
}
if number == self.numbers.read().unwrap().len() {
let len = self.numbers.read().unwrap().len();
if number == len {
*self.difficulty.write().unwrap().deref_mut() += header.difficulty;
mem::replace(self.last_hash.write().unwrap().deref_mut(), header.hash());
self.blocks.write().unwrap().insert(header.hash(), b);
@@ -155,7 +156,8 @@ impl BlockChainClient for TestBlockChainClient {
fn queue_info(&self) -> BlockQueueInfo {
BlockQueueInfo {
full: false,
queue_size: 0,
verified_queue_size: 0,
unverified_queue_size: 0,
}
}