Skip to content

Commit 93d33d2

Browse files
committed
Make sure to wait for blocks to be imported and stop on any error
1 parent c53e74b commit 93d33d2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

crates/subspace-node/src/import_blocks_from_dsn.rs

+16
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,22 @@ where
280280
}
281281
}
282282

283+
while link.imported_blocks < imported_blocks {
284+
futures::future::poll_fn(|ctx| {
285+
import_queue.poll_actions(ctx, &mut link);
286+
287+
Poll::Ready(())
288+
})
289+
.await;
290+
291+
if let Some(WaitLinkError { error, hash }) = &link.error {
292+
return Err(sc_service::Error::Other(format!(
293+
"Stopping block import after #{} blocks on {} because of an error: {}",
294+
link.imported_blocks, hash, error
295+
)));
296+
}
297+
}
298+
283299
info!(
284300
"🎉 Imported {} blocks, best #{}, exiting...",
285301
imported_blocks,

0 commit comments

Comments
 (0)