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>(
205
205
206
206
// We avoid fetching blocks higher than previously fetched `latest_blocks` as the local chain
207
207
// 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" ) ;
210
211
return Ok ( None ) ;
211
212
}
213
+ Some ( tip_height) => {
214
+ if height > tip_height {
215
+ return Ok ( None ) ;
216
+ }
217
+ }
212
218
}
213
219
214
220
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(
190
190
191
191
// We avoid fetching blocks higher than previously fetched `latest_blocks` as the local chain
192
192
// 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" ) ;
195
196
return Ok ( None ) ;
196
197
}
198
+ Some ( tip_height) => {
199
+ if height > tip_height {
200
+ return Ok ( None ) ;
201
+ }
202
+ }
197
203
}
198
204
199
205
Ok ( Some ( client. get_block_hash ( height) ?) )
You can’t perform that action at this time.
0 commit comments