File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -430,17 +430,16 @@ impl ShareChain for InMemoryShareChain {
430
430
let mut excluded_uncles = vec ! [ ] ;
431
431
let mut uncles = vec ! [ ] ;
432
432
for height in new_height. saturating_sub ( 3 ) ..new_height {
433
- let older_level = chain_read_lock
434
- . level_at_height ( height)
435
- . ok_or ( Error :: BlockLevelNotFound ) ?;
436
- let chain_block = older_level. block_in_main_chain ( ) . ok_or ( Error :: BlockNotFound ) ?;
437
- // Blocks in the main chain can't be uncles
438
- excluded_uncles. push ( chain_block. hash ) ;
439
- for uncle in chain_block. uncles . iter ( ) {
440
- excluded_uncles. push ( uncle. 1 ) ;
441
- }
442
- for block in older_level. blocks . iter ( ) {
443
- uncles. push ( ( height, block. 0 . clone ( ) ) ) ;
433
+ if let Some ( older_level) = chain_read_lock. level_at_height ( height) {
434
+ let chain_block = older_level. block_in_main_chain ( ) . ok_or ( Error :: BlockNotFound ) ?;
435
+ // Blocks in the main chain can't be uncles
436
+ excluded_uncles. push ( chain_block. hash ) ;
437
+ for uncle in chain_block. uncles . iter ( ) {
438
+ excluded_uncles. push ( uncle. 1 ) ;
439
+ }
440
+ for block in older_level. blocks . iter ( ) {
441
+ uncles. push ( ( height, block. 0 . clone ( ) ) ) ;
442
+ }
444
443
}
445
444
}
446
445
You can’t perform that action at this time.
0 commit comments