allow 'latest' metadata to be returned from the fallback code (#1127)

This commit is contained in:
James Wilson
2023-08-21 12:37:04 +01:00
committed by GitHub
parent b763bf5f1d
commit ab84228af4
2 changed files with 10 additions and 10 deletions
+6 -2
View File
@@ -201,14 +201,18 @@ async fn fetch_metadata(
client: &impl ClientT,
version: MetadataVersion,
) -> Result<Vec<u8>, FetchMetadataError> {
if !matches!(version, MetadataVersion::Version(14)) {
// If the user specifically asks for anything other than version 14 or "latest", error.
if !matches!(
version,
MetadataVersion::Latest | MetadataVersion::Version(14)
) {
return Err(FetchMetadataError::Other(
"The node can only return version 14 metadata using the legacy API but you've asked for something else"
.to_string(),
));
}
// Fetch the metadata at that version:
// Fetch the metadata.
let metadata_string: String = client
.request("state_call", rpc_params!["Metadata_metadata", "0x"])
.await?;