Skip to content

Commit

Permalink
fix deserializing rpc response
Browse files Browse the repository at this point in the history
  • Loading branch information
clangenb committed Oct 26, 2024
1 parent 1154741 commit 1808e66
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cli/src/trusted_operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,12 @@ pub(crate) fn send_direct_request(
into_default_trusted_op_err("failed to receive rpc response")
})?;

let response = RpcResponse::from_hex(&response_string)
.map_err(|e| into_default_trusted_op_err(format!("{e:?}")))?;
let response: RpcResponse = serde_json::from_str(&response_string).map_err(|e| {
into_default_trusted_op_err(format!("Error deserializing RpcResponse: {e:?}"))
})?;

let top_hash = Hash::from_hex(&response.result)
.map_err(|e| into_default_trusted_op_err(format!("{e:?}")))?;
.map_err(|e| into_default_trusted_op_err(format!("Error decoding top hash: {e:?}")))?;

debug!("subscribing to updates for top with hash: {top_hash:?}");

Expand Down

0 comments on commit 1808e66

Please sign in to comment.