mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 07:31:02 +00:00
pause relays(s) when node is syncing (#605)
This commit is contained in:
committed by
Bastian Köcher
parent
8ee90afae6
commit
8953967d92
@@ -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());
|
||||
|
||||
|
||||
@@ -99,6 +99,10 @@ where
|
||||
P::TargetHeaderHash: Decode,
|
||||
{
|
||||
async fn state(&self) -> Result<SourceClientState<P>, SubstrateError> {
|
||||
// we can't continue to deliver confirmations if source node is out of sync, because
|
||||
// it may have already received confirmations that we're going to deliver
|
||||
self.client.ensure_synced().await?;
|
||||
|
||||
read_client_state::<_, P::TargetHeaderHash, P::TargetHeaderNumber>(
|
||||
&self.client,
|
||||
P::BEST_FINALIZED_TARGET_HEADER_ID_AT_SOURCE,
|
||||
|
||||
@@ -95,6 +95,10 @@ where
|
||||
P::SourceHeaderHash: Decode,
|
||||
{
|
||||
async fn state(&self) -> Result<TargetClientState<P>, SubstrateError> {
|
||||
// we can't continue to deliver messages if target node is out of sync, because
|
||||
// it may have already received (some of) messages that we're going to deliver
|
||||
self.client.ensure_synced().await?;
|
||||
|
||||
read_client_state::<_, P::SourceHeaderHash, P::SourceHeaderNumber>(
|
||||
&self.client,
|
||||
P::BEST_FINALIZED_SOURCE_HEADER_ID_AT_TARGET,
|
||||
|
||||
Reference in New Issue
Block a user