Skip to content

Commit

Permalink
fix eth rpc behavioral bug
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <[email protected]>
  • Loading branch information
onur-ozkan committed Mar 22, 2024
1 parent 96fac7c commit 03f0581
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions mm2src/coins/eth/eth_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,18 @@ impl EthCoin {
clients.rotate_left(i);
return Ok(r);
},
Ok(Err(rpc_error)) => {
debug!("Request on '{method}' failed. Error: {rpc_error}");

if let Web3Transport::Websocket(socket_transport) = client.web3.transport() {
socket_transport.stop_connection_loop().await;
Ok(Err(error)) => {
debug!("Request on '{method}' failed. Error: {error}");

match error {
web3::Error::Rpc(rpc_error) => {
return Err(web3::Error::Rpc(rpc_error));
},
_ => {
if let Web3Transport::Websocket(socket_transport) = client.web3.transport() {
socket_transport.stop_connection_loop().await;
};
},
};
},
Err(timeout_error) => {
Expand Down

0 comments on commit 03f0581

Please sign in to comment.