Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
add new function to all RelayChainInterface implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
rphmeier committed May 15, 2023
1 parent 03a880a commit bbce10e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client/consensus/common/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ impl RelayChainInterface for Relaychain {
}

async fn wait_for_block(&self, _: PHash) -> RelayChainResult<()> {
unimplemented!("Not needed for test")
}

async fn new_best_notification_stream(
Expand All @@ -207,6 +206,10 @@ impl RelayChainInterface for Relaychain {
})
.boxed())
}

async fn header(&self, block_id: PHash) -> RelayChainResult<Option<PHeader>> {
unimplemented!("Not needed for test")
}
}

fn build_block<B: InitBlockBuilder>(
Expand Down
4 changes: 4 additions & 0 deletions client/network/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ impl RelayChainInterface for DummyRelayChainInterface {
});
Ok(Box::pin(notifications_stream))
}

async fn header(&self, block_id: PHash) -> RelayChainResult<Option<PHeader>> {
unimplemented!("Not needed for test")
}
}

fn make_validator_and_api(
Expand Down
4 changes: 4 additions & 0 deletions client/relay-chain-inprocess-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ where
Ok(self.sync_oracle.is_major_syncing())
}

async fn header(&self, block_id: PHash) -> RelayChainResult<Option<PHeader>> {
Ok(self.backend.header(block_hash)?)
}

fn overseer_handle(&self) -> RelayChainResult<Handle> {
Ok(self.overseer_handle.clone())
}
Expand Down
4 changes: 4 additions & 0 deletions client/relay-chain-rpc-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ impl RelayChainInterface for RelayChainRpcInterface {
self.rpc_client.system_health().await.map(|h| h.is_syncing)
}

async fn header(&self, block_id: RelayHash) -> RelayChainResult<Option<RelayHeader>> {
self.rpc_client.chain_get_header(Some(block_id)).await
}

fn overseer_handle(&self) -> RelayChainResult<Handle> {
Ok(self.overseer_handle.clone())
}
Expand Down

0 comments on commit bbce10e

Please sign in to comment.