File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -264,8 +264,7 @@ async fn update_scan_status(
264
264
message. account = account. name . clone ( ) ;
265
265
let mut blocks = message. blocks . clone ( ) ;
266
266
blocks. sort_by ( |a, b| b. sequence . cmp ( & a. sequence ) ) ;
267
- let mut start_hash = String :: new ( ) ;
268
- let mut end_hash;
267
+ let mut start_hash = message. start . clone ( ) ;
269
268
loop {
270
269
let mut message = message. clone ( ) ;
271
270
let mut limited_blocks = Vec :: with_capacity ( batch_size) ;
@@ -278,21 +277,18 @@ async fn update_scan_status(
278
277
if !first_request && limited_blocks. is_empty ( ) {
279
278
break ;
280
279
}
281
- if !first_request {
282
- message. start = start_hash;
283
- }
280
+ message. start = start_hash. clone ( ) ;
284
281
if !limited_blocks. is_empty ( ) && !blocks. is_empty ( ) {
285
- end_hash = limited_blocks. last ( ) . unwrap ( ) . hash . clone ( ) ;
286
- } else {
287
- end_hash = message. end . clone ( ) ;
282
+ let last_block = limited_blocks. last ( ) . unwrap ( ) ;
283
+ message. end = last_block. hash . clone ( ) ;
284
+ let q = shared. rpc_handler . get_blocks ( last_block. sequence as u64 , last_block. sequence as u64 + 1 ) ?;
285
+ start_hash = q. data . blocks [ q. data . blocks . len ( ) - 1 ] . block . hash . clone ( ) ;
288
286
}
289
287
290
- message. end = end_hash. clone ( ) ;
291
288
message. blocks = limited_blocks;
292
289
shared. rpc_handler . set_account_head ( message) ?;
293
290
{
294
291
first_request = false ;
295
- start_hash = end_hash;
296
292
}
297
293
}
298
294
if scan_complete {
You can’t perform that action at this time.
0 commit comments