Skip to content

Commit

Permalink
mmproxy/monero: Implement generateblocks RPC
Browse files Browse the repository at this point in the history
  • Loading branch information
parazyd committed Nov 8, 2023
1 parent 435992d commit d8247cf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/darkfi-mmproxy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ impl RequestHandler for MiningProxy {
"getblocktemplate" => self.monero_get_block_template(req.id, req.params).await,
"submit_block" => self.monero_submit_block(req.id, req.params).await,
"submitblock" => self.monero_submit_block(req.id, req.params).await,
"generateblocks" => self.monero_generateblocks(req.id, req.params).await,

/*
"generateblocks" => self.monero_generateblocks(req.id, req.params).await,
"get_last_block_header" => self.monero_get_last_block_header(req.id, req.params).await,
"get_block_header_by_hash" => self.monero_get_block_header_by_hash(req.id, req.params).await,
"get_block_header_by_height" => self.monero_get_block_header_by_height(req.id, req.params).await,
Expand Down
18 changes: 16 additions & 2 deletions bin/darkfi-mmproxy/src/monero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,25 @@ impl MiningProxy {
JsonResponse::new(rep, id).into()
}

/*
/// Generate a block and specify the address to receive the coinbase reward.
/// <https://www.getmonero.org/resources/developer-guides/daemon-rpc.html#generateblocks>
pub async fn monero_generateblocks(&self, id: u16, params: JsonValue) -> JsonResult {
todo!()
debug!(target: "rpc::monero", "generateblocks()");

// This request can just passthrough
let req = JsonRequest::new("generateblocks", params);
let rep = match self.oneshot_request(req).await {
Ok(v) => v,
Err(e) => {
error!(target: "rpc::monero::generateblocks", "[RPC] {}", e);
return JsonError::new(InternalError, Some(e.to_string()), id).into()
}
};

JsonResponse::new(rep, id).into()
}

/*
pub async fn monero_get_last_block_header(&self, id: u16, params: JsonValue) -> JsonResult {
todo!()
}
Expand Down

0 comments on commit d8247cf

Please sign in to comment.