pause relays(s) when node is syncing (#605)

This commit is contained in:
Svyatoslav Nikolsky
2021-02-02 13:27:18 +03:00
committed by Bastian Köcher
parent 8ee90afae6
commit 8953967d92
15 changed files with 93 additions and 6 deletions
@@ -73,6 +73,10 @@ where
P: SubstrateHeadersSyncPipeline<Completion = Justification, Extra = ()>,
{
async fn best_header_id(&self) -> Result<HeaderIdOf<P>, SubstrateError> {
// we can't continue to relay headers if target node is out of sync, because
// it may have already received (some of) headers that we're going to relay
self.client.ensure_synced().await?;
let call = P::BEST_BLOCK_METHOD.into();
let data = Bytes(Vec::new());