@@ -243,7 +243,9 @@ pub async fn find_potential_parents<B: BlockT>(
243243 current_rp = header. parent_hash ( ) . clone ( ) ;
244244
245245 // don't iterate back into the genesis block.
246- if header. number == 1 { break }
246+ if header. number == 1 {
247+ break
248+ }
247249 }
248250
249251 ancestry
@@ -253,22 +255,27 @@ pub async fn find_potential_parents<B: BlockT>(
253255 let is_root_in_ancestry = |root| rp_ancestry. iter ( ) . any ( |x| x. 1 == root) ;
254256
255257 // 2. Get the included and pending availability blocks.
256- let included_header = relay_client. persisted_validation_data (
257- params. relay_parent ,
258- params. para_id ,
259- OccupiedCoreAssumption :: TimedOut ,
260- ) . await ?;
258+ let included_header = relay_client
259+ . persisted_validation_data (
260+ params. relay_parent ,
261+ params. para_id ,
262+ OccupiedCoreAssumption :: TimedOut ,
263+ )
264+ . await ?;
261265
262266 let included_header = match included_header {
263267 Some ( pvd) => pvd. parent_head ,
264268 None => return Ok ( Vec :: new ( ) ) , // this implies the para doesn't exist.
265269 } ;
266270
267- let pending_header = relay_client. persisted_validation_data (
268- params. relay_parent ,
269- params. para_id ,
270- OccupiedCoreAssumption :: Included ,
271- ) . await ?. and_then ( |x| if x. parent_head != included_header { Some ( x. parent_head ) } else { None } ) ;
271+ let pending_header = relay_client
272+ . persisted_validation_data (
273+ params. relay_parent ,
274+ params. para_id ,
275+ OccupiedCoreAssumption :: Included ,
276+ )
277+ . await ?
278+ . and_then ( |x| if x. parent_head != included_header { Some ( x. parent_head ) } else { None } ) ;
272279
273280 let included_header = match B :: Header :: decode ( & mut & included_header. 0 [ ..] ) . ok ( ) {
274281 None => return Ok ( Vec :: new ( ) ) ,
@@ -290,17 +297,16 @@ pub async fn find_potential_parents<B: BlockT>(
290297 // relay parents.
291298 let mut potential_parents = Vec :: new ( ) ;
292299 while let Some ( entry) = frontier. pop ( ) {
293- let is_pending = entry . depth == 1
294- && pending_hash. as_ref ( ) . map_or ( false , |h| & entry. hash == h) ;
300+ let is_pending =
301+ entry . depth == 1 && pending_hash. as_ref ( ) . map_or ( false , |h| & entry. hash == h) ;
295302 let is_included = entry. depth == 0 ;
296303
297304 // note: even if the pending block or included block have a relay parent
298305 // outside of the expected part of the relay chain, they are always allowed
299306 // because they have already been posted on chain.
300307 let is_potential = is_pending || is_included || {
301308 let digest = entry. header . digest ( ) ;
302- cumulus_primitives_core:: extract_relay_parent ( digest)
303- . map_or ( false , is_hash_in_ancestry) ||
309+ cumulus_primitives_core:: extract_relay_parent ( digest) . map_or ( false , is_hash_in_ancestry) ||
304310 cumulus_primitives_core:: rpsr_digest:: extract_relay_parent_storage_root ( digest)
305311 . map_or ( false , is_root_in_ancestry)
306312 } ;
@@ -313,14 +319,17 @@ pub async fn find_potential_parents<B: BlockT>(
313319 potential_parents. push ( entry) ;
314320 }
315321
316- if !is_potential || child_depth > params. max_depth { continue }
322+ if !is_potential || child_depth > params. max_depth {
323+ continue
324+ }
317325
318326 // push children onto search frontier.
319327 for child in client. children ( hash) . ok ( ) . into_iter ( ) . flat_map ( |c| c) {
320- if params. ignore_alternative_branches
321- && is_included
322- && pending_hash. map_or ( false , |h| child != h)
323- { continue }
328+ if params. ignore_alternative_branches &&
329+ is_included && pending_hash. map_or ( false , |h| child != h)
330+ {
331+ continue
332+ }
324333
325334 let header = match client. header ( child) {
326335 Ok ( Some ( h) ) => h,
0 commit comments