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

fix: regression of sync_state_genSyncSpec #11435 #11437

Merged
merged 2 commits into from
May 17, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 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,9 @@ 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())
chain_spec
.as_json(raw)
.map(Into::into)
niklasad1 marked this conversation as resolved.
Show resolved Hide resolved
niklasad1 marked this conversation as resolved.
Show resolved Hide resolved
.map_err(|e| Error::<Block>::JsonRpc(e).into())
}
}