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

Commit

Permalink
fix: regression of sync_state_genSyncSpec paritytech#11435 (parityt…
Browse files Browse the repository at this point in the history
…ech#11437)

* fix: paritytech#11435

* address grumbles: better safe than sorry
  • Loading branch information
niklasad1 authored and DaviRain-Su committed Aug 23, 2022
1 parent a758ce4 commit d21d325
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions client/sync-state-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub struct LightSyncState<Block: BlockT> {
pub trait SyncStateRpcApi {
/// Returns the JSON serialized chainspec running the node, with a sync state.
#[method(name = "sync_state_genSyncSpec")]
fn system_gen_sync_spec(&self, raw: bool) -> RpcResult<String>;
fn system_gen_sync_spec(&self, raw: bool) -> RpcResult<serde_json::Value>;
}

/// An api for sync state RPC calls.
Expand Down Expand Up @@ -185,7 +185,7 @@ where
Block: BlockT,
Backend: HeaderBackend<Block> + sc_client_api::AuxStore + 'static,
{
fn system_gen_sync_spec(&self, raw: bool) -> RpcResult<String> {
fn system_gen_sync_spec(&self, raw: bool) -> RpcResult<serde_json::Value> {
let current_sync_state = self.build_sync_state()?;
let mut chain_spec = self.chain_spec.cloned_box();

Expand All @@ -197,6 +197,7 @@ where
let val = serde_json::to_value(&current_sync_state)?;
*extension = Some(val);

chain_spec.as_json(raw).map_err(|e| Error::<Block>::JsonRpc(e).into())
let json_str = chain_spec.as_json(raw).map_err(|e| Error::<Block>::JsonRpc(e))?;
serde_json::from_str(&json_str).map_err(Into::into)
}
}

0 comments on commit d21d325

Please sign in to comment.