diff --git a/blockchain/chain_sync/src/tipset_syncer.rs b/blockchain/chain_sync/src/tipset_syncer.rs index 6c8179eeac7d..0b6a0fa75375 100644 --- a/blockchain/chain_sync/src/tipset_syncer.rs +++ b/blockchain/chain_sync/src/tipset_syncer.rs @@ -3,7 +3,6 @@ use forest_utils::io::ProgressBar; use futures::stream::FuturesUnordered; -use futures::StreamExt; use futures::TryFutureExt; use fvm_shared::bigint::BigInt; use fvm_shared::crypto::signature::ops::verify_bls_aggregate; @@ -1153,7 +1152,7 @@ async fn validate_tipset( - consensus.clone(), - state_manager.clone(), - Arc::new(b), - )); - validations.push(validation_fn); + let consensus = consensus.clone(); + let state_manager = state_manager.clone(); + let validation_fn = tokio::task::spawn_blocking(|| { + validate_block::<_, C>(consensus, state_manager, Arc::new(b)) + }); + validations.spawn(validation_fn); } - while let Some(result) = validations.next().await { - match result? { + while let Some(result) = validations.join_next().await { + match result??.await { Ok(block) => { chainstore.add_to_tipset_tracker(block.header()).await; }