Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
address grumbles
Browse files Browse the repository at this point in the history
  • Loading branch information
rphmeier committed Dec 27, 2016
1 parent 0688ccb commit 55dbfbf
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions ethcore/light/src/client/header_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,16 @@ impl HeaderChain {
let mut candidates = self.candidates.write();

// find parent details.
let parent_td = {
let parent_td =
if number == 1 {
let g_view = HeaderView::new(&self.genesis_header);
g_view.difficulty()
} else {
let maybe_td = candidates.get(&(number - 1))
candidates.get(&(number - 1))
.and_then(|entry| entry.candidates.iter().find(|c| c.hash == parent_hash))
.map(|c| c.total_difficulty);

match maybe_td {
Some(td) => td,
None => return Err(BlockError::UnknownParent(parent_hash)),
}
}
};
.map(|c| c.total_difficulty)
.ok_or_else(|| BlockError::UnknownParent(parent_hash))?
};

let total_difficulty = parent_td + view.difficulty();

Expand Down Expand Up @@ -230,9 +225,7 @@ impl HeaderChain {

/// Get the genesis hash.
pub fn genesis_hash(&self) -> H256 {
use util::Hashable;

self.genesis_header.sha3()
::util::Hashable::sha3(&self.genesis_header)
}

/// Get the best block's data.
Expand Down

0 comments on commit 55dbfbf

Please sign in to comment.