Change Runtime APIs best_finalized() signature

Change Runtime APIs best_finalized() signature to return Option<HeaderId>

Signed-off-by: Serban Iorga <serban@parity.io>
This commit is contained in:
Serban Iorga
2022-07-28 15:18:40 +03:00
committed by Bastian Köcher
parent f13211344b
commit 7969459d07
14 changed files with 39 additions and 43 deletions
@@ -562,17 +562,13 @@ where
Some(at_self_hash),
)
.await?;
let decoded_best_finalized_peer_on_self =
Option::<(BlockNumberOf<PeerChain>, HashOf<PeerChain>)>::decode(
&mut &encoded_best_finalized_peer_on_self.0[..],
)
.map_err(SubstrateError::ResponseParseFailed)?
.map(Ok)
.unwrap_or(Err(SubstrateError::BridgePalletIsNotInitialized))?;
let peer_on_self_best_finalized_id =
HeaderId(decoded_best_finalized_peer_on_self.0, decoded_best_finalized_peer_on_self.1);
Ok(peer_on_self_best_finalized_id)
Option::<HeaderId<HashOf<PeerChain>, BlockNumberOf<PeerChain>>>::decode(
&mut &encoded_best_finalized_peer_on_self.0[..],
)
.map_err(SubstrateError::ResponseParseFailed)?
.map(Ok)
.unwrap_or(Err(SubstrateError::BridgePalletIsNotInitialized))
}
fn make_message_details_map<C: Chain>(
@@ -107,14 +107,13 @@ where
Some(at_block.1),
)
.await?;
let decoded_best_finalized_source_block =
Option::<(BlockNumberOf<P::SourceRelayChain>, HashOf<P::SourceRelayChain>)>::decode(
&mut &encoded_best_finalized_source_block.0[..],
)
.map_err(SubstrateError::ResponseParseFailed)?
.map(Ok)
.unwrap_or(Err(SubstrateError::BridgePalletIsNotInitialized))?;
Ok(HeaderId(decoded_best_finalized_source_block.0, decoded_best_finalized_source_block.1))
Option::<HeaderId<HashOf<P::SourceRelayChain>, BlockNumberOf<P::SourceRelayChain>>>::decode(
&mut &encoded_best_finalized_source_block.0[..],
)
.map_err(SubstrateError::ResponseParseFailed)?
.map(Ok)
.unwrap_or(Err(SubstrateError::BridgePalletIsNotInitialized))
}
async fn parachain_head(