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

Commit

Permalink
Optimized uncle check
Browse files Browse the repository at this point in the history
  • Loading branch information
arkpar committed Jun 27, 2017
1 parent c6e3d40 commit 7db607f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ethcore/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1661,11 +1661,12 @@ impl MiningBlockChainClient for Client {
let h = chain.best_block_hash();
// Add new uncles
let uncles = chain
.find_uncle_headers(&h, engine.maximum_uncle_age())
.find_uncle_hashes(&h, engine.maximum_uncle_age())
.unwrap_or_else(Vec::new);

for uncle in uncles {
if !block.uncles().iter().any(|header| header.hash() == uncle.hash()) {
for h in uncles {
if !block.uncles().iter().any(|header| header.hash() == h) {
let uncle = chain.block_header(&h).expect("find_uncle_hashes only returns hashes for existing headers; qed");
block.push_uncle(uncle).expect("pushing up to maximum_uncle_count;
push_uncle is not ok only if more than maximum_uncle_count is pushed;
so all push_uncle are Ok;
Expand Down

0 comments on commit 7db607f

Please sign in to comment.