@@ -38,10 +38,7 @@ use std::collections::HashSet;
3838use  std:: io:: prelude:: * ; 
3939use  std:: sync:: Arc ; 
4040use  std:: time:: { Duration ,  Instant } ; 
41- use  store:: iter:: { 
42-     BlockRootsIterator ,  ParentRootBlockIterator ,  ReverseBlockRootIterator , 
43-     ReverseStateRootIterator ,  StateRootsIterator , 
44- } ; 
41+ use  store:: iter:: { BlockRootsIterator ,  ParentRootBlockIterator ,  StateRootsIterator } ; 
4542use  store:: { Error  as  DBError ,  Store } ; 
4643use  types:: * ; 
4744
@@ -322,17 +319,12 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
322319     /// - Iterator returns `(Hash256, Slot)`. 
323320     /// - As this iterator starts at the `head` of the chain (viz., the best block), the first slot 
324321     ///     returned may be earlier than the wall-clock slot. 
325-      pub  fn  rev_iter_block_roots ( 
326-         & self , 
327-     )  -> Result < ReverseBlockRootIterator < T :: EthSpec ,  T :: Store > ,  Error >  { 
322+      pub  fn  rev_iter_block_roots ( & self )  -> Result < impl  Iterator < Item  = ( Hash256 ,  Slot ) > ,  Error >  { 
328323        let  head = self . head ( ) ?; 
329324
330325        let  iter = BlockRootsIterator :: owned ( self . store . clone ( ) ,  head. beacon_state ) ; 
331326
332-         Ok ( ReverseBlockRootIterator :: new ( 
333-             ( head. beacon_block_root ,  head. beacon_block . slot ( ) ) , 
334-             iter, 
335-         ) ) 
327+         Ok ( std:: iter:: once ( ( head. beacon_block_root ,  head. beacon_block . slot ( ) ) ) . chain ( iter) ) 
336328    } 
337329
338330    pub  fn  forwards_iter_block_roots ( 
@@ -362,18 +354,15 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
362354     pub  fn  rev_iter_block_roots_from ( 
363355        & self , 
364356        block_root :  Hash256 , 
365-     )  -> Result < ReverseBlockRootIterator < T :: EthSpec ,   T :: Store > ,  Error >  { 
357+     )  -> Result < impl   Iterator < Item  =  ( Hash256 ,   Slot ) > ,  Error >  { 
366358        let  block = self 
367359            . get_block ( & block_root) ?
368360            . ok_or_else ( || Error :: MissingBeaconBlock ( block_root) ) ?; 
369361        let  state = self 
370362            . get_state ( & block. state_root ( ) ,  Some ( block. slot ( ) ) ) ?
371363            . ok_or_else ( || Error :: MissingBeaconState ( block. state_root ( ) ) ) ?; 
372364        let  iter = BlockRootsIterator :: owned ( self . store . clone ( ) ,  state) ; 
373-         Ok ( ReverseBlockRootIterator :: new ( 
374-             ( block_root,  block. slot ( ) ) , 
375-             iter, 
376-         ) ) 
365+         Ok ( std:: iter:: once ( ( block_root,  block. slot ( ) ) ) . chain ( iter) ) 
377366    } 
378367
379368    /// Traverse backwards from `block_root` to find the root of the ancestor block at `slot`. 
@@ -397,18 +386,13 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
397386     /// - Iterator returns `(Hash256, Slot)`. 
398387     /// - As this iterator starts at the `head` of the chain (viz., the best block), the first slot 
399388     ///     returned may be earlier than the wall-clock slot. 
400-      pub  fn  rev_iter_state_roots ( 
401-         & self , 
402-     )  -> Result < ReverseStateRootIterator < T :: EthSpec ,  T :: Store > ,  Error >  { 
389+      pub  fn  rev_iter_state_roots ( & self )  -> Result < impl  Iterator < Item  = ( Hash256 ,  Slot ) > ,  Error >  { 
403390        let  head = self . head ( ) ?; 
404391        let  slot = head. beacon_state . slot ; 
405392
406393        let  iter = StateRootsIterator :: owned ( self . store . clone ( ) ,  head. beacon_state ) ; 
407394
408-         Ok ( ReverseStateRootIterator :: new ( 
409-             ( head. beacon_state_root ,  slot) , 
410-             iter, 
411-         ) ) 
395+         Ok ( std:: iter:: once ( ( head. beacon_state_root ,  slot) ) . chain ( iter) ) 
412396    } 
413397
414398    /// Returns the block at the given slot, if any. Only returns blocks in the canonical chain. 
0 commit comments