Rpc: remove not required clone
This commit is contained in:
parent
6f08f9decd
commit
9542bae56e
|
@ -125,10 +125,8 @@ impl RpcSender for HttpSender {
|
|||
.body(request_json)
|
||||
.send()
|
||||
})
|
||||
};
|
||||
}?;
|
||||
|
||||
match response {
|
||||
Ok(response) => {
|
||||
if !response.status().is_success() {
|
||||
if response.status() == StatusCode::TOO_MANY_REQUESTS
|
||||
&& too_many_requests_retries > 0
|
||||
|
@ -157,12 +155,10 @@ impl RpcSender for HttpSender {
|
|||
return Err(response.error_for_status().unwrap_err().into());
|
||||
}
|
||||
|
||||
let response_text = tokio::task::block_in_place(move || response.text())?;
|
||||
|
||||
let json: serde_json::Value = serde_json::from_str(&response_text)?;
|
||||
let mut json =
|
||||
tokio::task::block_in_place(move || response.json::<serde_json::Value>())?;
|
||||
if json["error"].is_object() {
|
||||
return match serde_json::from_value::<RpcErrorObject>(json["error"].clone())
|
||||
{
|
||||
return match serde_json::from_value::<RpcErrorObject>(json["error"].clone()) {
|
||||
Ok(rpc_error_object) => {
|
||||
let data = match rpc_error_object.code {
|
||||
rpc_custom_error::JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE => {
|
||||
|
@ -200,12 +196,7 @@ impl RpcSender for HttpSender {
|
|||
.into()),
|
||||
};
|
||||
}
|
||||
return Ok(json["result"].clone());
|
||||
}
|
||||
Err(err) => {
|
||||
return Err(err.into());
|
||||
}
|
||||
}
|
||||
return Ok(json["result"].take());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue