Skip to content

Commit

Permalink
fix: backwards compatible rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
dandanlen committed Oct 16, 2023
1 parent a9fa3d4 commit 4d8d565
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 6 additions & 4 deletions engine/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ async fn main() -> anyhow::Result<()> {
loop {
poll_interval.tick().await;

let current_release_version: SemVer = ws_rpc_client
.request("cf_current_release_version", Vec::<()>::new())
.await
.unwrap();
let (current_release_version, _) = futures::future::select_ok([
ws_rpc_client.request("cf_current_release_version", Vec::<()>::new()),
ws_rpc_client.request("cf_current_compatibility_version", Vec::<()>::new()),
])
.await
.expect("Failed to get current release version");

let compatible = CFE_VERSION.is_compatible_with(current_release_version);

Expand Down
6 changes: 5 additions & 1 deletion state-chain/custom-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ pub trait CustomApi {
) -> RpcResult<Option<AssetsMap<Amount>>>;
#[method(name = "environment")]
fn cf_environment(&self, at: Option<state_chain_runtime::Hash>) -> RpcResult<RpcEnvironment>;
#[method(name = "current_release_version")]
#[method(
name = "current_release_version",
// NOTE: deprecated, use `cf_current_release_version` instead
aliases = ["cf_current_compatibility_version"]
)]
fn cf_current_release_version(
&self,
at: Option<state_chain_runtime::Hash>,
Expand Down

0 comments on commit 4d8d565

Please sign in to comment.