@@ -16,7 +16,7 @@ pub struct EliasFano {
1616impl EliasFano {
1717 /// Compress a unique, ordered set of elements.
1818 pub fn compress ( elements : & [ u32 ] ) -> Self {
19- debug_assert ! ( elements. is_sorted ( ) ) ;
19+ debug_assert ! ( elements. windows ( 2 ) . all ( |w| w [ 0 ] < w [ 1 ] ) ) ;
2020 debug_assert ! ( elements. len( ) < u32 :: MAX as usize ) ;
2121 if elements. is_empty ( ) {
2222 return Self {
@@ -246,6 +246,7 @@ fn read_compact_size<R: Read>(reader: &mut R) -> Result<u32, std::io::Error> {
246246#[ derive( Debug ) ]
247247pub struct Hintsfile {
248248 map : BTreeMap < u32 , EliasFano > ,
249+ stop_height : u32 ,
249250}
250251
251252impl Hintsfile {
@@ -273,7 +274,7 @@ impl Hintsfile {
273274 let ef = EliasFano :: from_reader ( reader) ?;
274275 map. insert ( height, ef) ;
275276 }
276- Ok ( Self { map } )
277+ Ok ( Self { map, stop_height } )
277278 }
278279
279280 /// Get the unspent indices for a block height. Returns `None` if unavailable.
@@ -289,7 +290,7 @@ impl Hintsfile {
289290
290291 /// The last height this file encodes for.
291292 pub fn stop_height ( & self ) -> u32 {
292- self . map . keys ( ) . max ( ) . copied ( ) . unwrap_or_default ( )
293+ self . stop_height
293294 }
294295}
295296
@@ -331,10 +332,10 @@ mod sealed {
331332 pub trait Sealed { }
332333}
333334
334- impl sealed:: Sealed for crate :: StageNew { }
335- impl sealed:: Sealed for crate :: StageInProgress { }
335+ impl sealed:: Sealed for StageNew { }
336+ impl sealed:: Sealed for StageInProgress { }
336337
337- /// Stage of hintsfile prgroess .
338+ /// Stage of hintsfile progress .
338339pub trait Stage : sealed:: Sealed { }
339340
340341impl Stage for StageNew { }
0 commit comments