File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -205,10 +205,16 @@ async fn fetch_block<S: Sleeper>(
205205
206206 // We avoid fetching blocks higher than previously fetched `latest_blocks` as the local chain
207207 // tip is used to signal for the last-synced-up-to-height.
208- if let Some ( tip_height) = latest_blocks. keys ( ) . last ( ) . copied ( ) {
209- if height > tip_height {
208+ match latest_blocks. keys ( ) . last ( ) . copied ( ) {
209+ None => {
210+ debug_assert ! ( false , "`latest_blocks` should not be empty" ) ;
210211 return Ok ( None ) ;
211212 }
213+ Some ( tip_height) => {
214+ if height > tip_height {
215+ return Ok ( None ) ;
216+ }
217+ }
212218 }
213219
214220 Ok ( Some ( client. get_block_hash ( height) . await ?) )
Original file line number Diff line number Diff line change @@ -190,10 +190,16 @@ fn fetch_block(
190190
191191 // We avoid fetching blocks higher than previously fetched `latest_blocks` as the local chain
192192 // tip is used to signal for the last-synced-up-to-height.
193- if let Some ( tip_height) = latest_blocks. keys ( ) . last ( ) . copied ( ) {
194- if height > tip_height {
193+ match latest_blocks. keys ( ) . last ( ) . copied ( ) {
194+ None => {
195+ debug_assert ! ( false , "`latest_blocks` should not be empty" ) ;
195196 return Ok ( None ) ;
196197 }
198+ Some ( tip_height) => {
199+ if height > tip_height {
200+ return Ok ( None ) ;
201+ }
202+ }
197203 }
198204
199205 Ok ( Some ( client. get_block_hash ( height) ?) )
You can’t perform that action at this time.
0 commit comments