File tree 1 file changed +15
-11
lines changed
1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -325,17 +325,21 @@ impl<N: Network> Sync<N> {
325
325
// Acquire the sync lock.
326
326
let _lock = self . sync_lock . lock ( ) . await ;
327
327
328
- // Check the next block.
329
- self . ledger . check_next_block ( & block) ?;
330
- // Attempt to advance to the next block.
331
- self . ledger . advance_to_next_block ( & block) ?;
332
-
333
- // Sync the height with the block.
334
- self . storage . sync_height_with_block ( block. height ( ) ) ;
335
- // Sync the round with the block.
336
- self . storage . sync_round_with_block ( block. round ( ) ) ;
337
-
338
- Ok ( ( ) )
328
+ let self_ = self . clone ( ) ;
329
+ tokio:: task:: spawn_blocking ( move || {
330
+ // Check the next block.
331
+ self_. ledger . check_next_block ( & block) ?;
332
+ // Attempt to advance to the next block.
333
+ self_. ledger . advance_to_next_block ( & block) ?;
334
+
335
+ // Sync the height with the block.
336
+ self_. storage . sync_height_with_block ( block. height ( ) ) ;
337
+ // Sync the round with the block.
338
+ self_. storage . sync_round_with_block ( block. round ( ) ) ;
339
+
340
+ Ok ( ( ) )
341
+ } )
342
+ . await ?
339
343
}
340
344
341
345
/// Syncs the storage with the given blocks.
You can’t perform that action at this time.
0 commit comments