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

Commit bbce10e

Browse files
committed
add new function to all RelayChainInterface implementations
1 parent 03a880a commit bbce10e

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

client/consensus/common/src/tests.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ impl RelayChainInterface for Relaychain {
186186
}
187187

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

192191
async fn new_best_notification_stream(
@@ -207,6 +206,10 @@ impl RelayChainInterface for Relaychain {
207206
})
208207
.boxed())
209208
}
209+
210+
async fn header(&self, block_id: PHash) -> RelayChainResult<Option<PHeader>> {
211+
unimplemented!("Not needed for test")
212+
}
210213
}
211214

212215
fn build_block<B: InitBlockBuilder>(

client/network/src/tests.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@ impl RelayChainInterface for DummyRelayChainInterface {
237237
});
238238
Ok(Box::pin(notifications_stream))
239239
}
240+
241+
async fn header(&self, block_id: PHash) -> RelayChainResult<Option<PHeader>> {
242+
unimplemented!("Not needed for test")
243+
}
240244
}
241245

242246
fn make_validator_and_api(

client/relay-chain-inprocess-interface/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ where
171171
Ok(self.sync_oracle.is_major_syncing())
172172
}
173173

174+
async fn header(&self, block_id: PHash) -> RelayChainResult<Option<PHeader>> {
175+
Ok(self.backend.header(block_hash)?)
176+
}
177+
174178
fn overseer_handle(&self) -> RelayChainResult<Handle> {
175179
Ok(self.overseer_handle.clone())
176180
}

client/relay-chain-rpc-interface/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ impl RelayChainInterface for RelayChainRpcInterface {
132132
self.rpc_client.system_health().await.map(|h| h.is_syncing)
133133
}
134134

135+
async fn header(&self, block_id: RelayHash) -> RelayChainResult<Option<RelayHeader>> {
136+
self.rpc_client.chain_get_header(Some(block_id)).await
137+
}
138+
135139
fn overseer_handle(&self) -> RelayChainResult<Handle> {
136140
Ok(self.overseer_handle.clone())
137141
}

0 commit comments

Comments
 (0)