From da1fa2799d27a95ebb4ef0dfc491d6dccaff59fe Mon Sep 17 00:00:00 2001 From: lunar-mining Date: Fri, 24 Sep 2021 12:08:11 +0200 Subject: [PATCH] bin/darkfid: added 'put_keypair()' to 'key_gen()' method --- src/bin/darkfid.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/bin/darkfid.rs b/src/bin/darkfid.rs index cbd7f3c1b..2bfa3996c 100644 --- a/src/bin/darkfid.rs +++ b/src/bin/darkfid.rs @@ -89,7 +89,12 @@ impl Darkfid { // <-- {"result": true} async fn key_gen(&self, id: Value, _params: Value) -> JsonResult { match self.wallet.key_gen() { - Ok((_, _)) => return JsonResult::Resp(jsonresp(json!(true), id)), + Ok((public, private)) => match self.wallet.put_keypair(public, private) { + Ok(()) => return JsonResult::Resp(jsonresp(json!(true), id)), + Err(e) => { + return JsonResult::Err(jsonerr(ServerError(-32002), Some(e.to_string()), id)) + } + }, Err(e) => { return JsonResult::Err(jsonerr(ServerError(-32002), Some(e.to_string()), id)) } @@ -157,7 +162,6 @@ impl Darkfid { // --> {""method": "features", "params": []} // <-- {"result": { "network": ["btc", "sol"] } } async fn features(&self, id: Value, _params: Value) -> JsonResult { - // TODO: return a dictionary of features let req = jsonreq(json!("features"), json!([])); let rep: JsonResult; match send_request(&self.config.cashier_rpc_url, json!(req)).await {