Skip to content

Commit

Permalink
fix(foot-shooting): remove leftover code that panics via RPC (#2270)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariocynicys authored and Alrighttt committed Nov 26, 2024
1 parent 121ea05 commit f01d827
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
1 change: 0 additions & 1 deletion mm2src/mm2_main/src/rpc/dispatcher/dispatcher_legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ pub fn dispatcher(req: Json, ctx: MmArc) -> DispatcherRes {
"order_status" => hyres(order_status(ctx, req)),
"orderbook" => hyres(orderbook_rpc(ctx, req)),
"orderbook_depth" => hyres(orderbook_depth_rpc(ctx, req)),
"sim_panic" => hyres(sim_panic(req)),
"recover_funds_of_swap" => hyres(recover_funds_of_swap(ctx, req)),
"sell" => hyres(sell(ctx, req)),
"show_priv_key" => hyres(show_priv_key(ctx, req)),
Expand Down
31 changes: 0 additions & 31 deletions mm2src/mm2_main/src/rpc/lp_commands/lp_commands_legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ use mm2_metrics::MetricsOps;
use mm2_number::construct_detailed;
use mm2_rpc::data::legacy::{BalanceResponse, CoinInitResponse, Mm2RpcResult, MmVersionResponse, Status};
use serde_json::{self as json, Value as Json};
use std::borrow::Cow;
use std::collections::HashSet;
use uuid::Uuid;

Expand Down Expand Up @@ -269,36 +268,6 @@ pub async fn stop(ctx: MmArc) -> Result<Response<Vec<u8>>, String> {
Ok(try_s!(Response::builder().body(res)))
}

pub async fn sim_panic(req: Json) -> Result<Response<Vec<u8>>, String> {
#[derive(Deserialize)]
struct Req {
#[serde(default)]
mode: String,
}
let req: Req = try_s!(json::from_value(req));

#[derive(Serialize)]
struct Ret<'a> {
/// Supported panic modes.
#[serde(skip_serializing_if = "Vec::is_empty")]
modes: Vec<Cow<'a, str>>,
}
let ret: Ret;

if req.mode.is_empty() {
ret = Ret {
modes: vec!["simple".into()],
}
} else if req.mode == "simple" {
panic!("sim_panic: simple")
} else {
return ERR!("No such mode: {}", req.mode);
}

let js = try_s!(json::to_vec(&ret));
Ok(try_s!(Response::builder().body(js)))
}

pub fn version(ctx: MmArc) -> HyRes {
match json::to_vec(&MmVersionResponse {
result: ctx.mm_version.clone(),
Expand Down

0 comments on commit f01d827

Please sign in to comment.