Quick fix for missing tree route blocks (#2400)

This commit is contained in:
Arkadiy Paronyan 2016-09-29 14:47:13 +02:00 committed by GitHub
parent 63d3a4dd59
commit e298ab30e4
1 changed files with 4 additions and 2 deletions

View File

@ -1346,8 +1346,10 @@ impl ChainSync {
let mut rlp_stream = RlpStream::new_list(blocks.len());
for block_hash in blocks {
let mut hash_rlp = RlpStream::new_list(2);
let number = HeaderView::new(&chain.block_header(BlockID::Hash(block_hash.clone()))
.expect("chain.tree_route and chain.find_uncles only return hahses of blocks that are in the blockchain. qed.")).number();
let number = match chain.block_header(BlockID::Hash(block_hash.clone())) {
Some(header) => HeaderView::new(&header).number(),
_ => return None,
};
hash_rlp.append(&block_hash);
hash_rlp.append(&number);
rlp_stream.append_raw(hash_rlp.as_raw(), 1);