don't wrap errors (#2830)

This commit is contained in:
Web3 Philosopher
2023-07-06 17:09:13 +02:00
committed by GitHub
parent 28bd109a3e
commit b665db6510
3 changed files with 17 additions and 9 deletions
+6 -3
View File
@@ -242,9 +242,12 @@ impl RelayChainInterface for DummyRelayChainInterface {
async fn header(&self, block_id: BlockId) -> RelayChainResult<Option<PHeader>> {
let hash = match block_id {
BlockId::Hash(hash) => hash,
BlockId::Number(num) => self.relay_client.hash(num)?.ok_or_else(|| {
RelayChainError::GenericError(format!("block with number {num} not found"))
})?,
BlockId::Number(num) =>
if let Some(hash) = self.relay_client.hash(num)? {
hash
} else {
return Ok(None)
},
};
let header = self.relay_client.header(hash)?;