mirror of
https://github.com/Cuprate/cuprate.git
synced 2025-01-26 04:15:55 +00:00
fixes
This commit is contained in:
parent
abfc3c503c
commit
f89e29eeba
4 changed files with 19 additions and 20 deletions
|
@ -8,7 +8,7 @@ use cuprate_rpc_types::bin::{
|
||||||
|
|
||||||
use crate::rpc::CupratedRpcHandler;
|
use crate::rpc::CupratedRpcHandler;
|
||||||
|
|
||||||
async fn map_request(state: CupratedRpcHandler, request: BinRpcRequest) -> BinRpcResponse {
|
pub(super) async fn map_request(state: CupratedRpcHandler, request: BinRpcRequest) -> BinRpcResponse {
|
||||||
use BinRpcRequest as Req;
|
use BinRpcRequest as Req;
|
||||||
use BinRpcResponse as Resp;
|
use BinRpcResponse as Resp;
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ async fn get_transaction_pool_hashes(
|
||||||
) -> GetTransactionPoolHashesResponse {
|
) -> GetTransactionPoolHashesResponse {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_output_distribution(
|
async fn get_output_distribution(
|
||||||
state: CupratedRpcHandler,
|
state: CupratedRpcHandler,
|
||||||
request: GetOutputDistributionRequest,
|
request: GetOutputDistributionRequest,
|
||||||
|
|
|
@ -53,27 +53,19 @@ impl Service<RpcRequest> for CupratedRpcHandler {
|
||||||
Poll::Ready(Ok(()))
|
Poll::Ready(Ok(()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// INVARIANT:
|
||||||
|
///
|
||||||
|
/// We don't need to check for `self.is_restricted()`
|
||||||
|
/// here because `cuprate-rpc-interface` handles that.
|
||||||
|
///
|
||||||
|
/// We can assume the request coming has the required permissions.
|
||||||
fn call(&mut self, req: RpcRequest) -> Self::Future {
|
fn call(&mut self, req: RpcRequest) -> Self::Future {
|
||||||
use cuprate_rpc_types::bin::BinRequest as BReq;
|
|
||||||
use cuprate_rpc_types::bin::BinResponse as BResp;
|
|
||||||
use cuprate_rpc_types::json::JsonRpcRequest as JReq;
|
|
||||||
use cuprate_rpc_types::json::JsonRpcResponse as JResp;
|
|
||||||
use cuprate_rpc_types::other::OtherRequest as OReq;
|
|
||||||
use cuprate_rpc_types::other::OtherResponse as OResp;
|
|
||||||
|
|
||||||
// INVARIANT:
|
|
||||||
//
|
|
||||||
// We don't need to check for `self.is_restricted()`
|
|
||||||
// here because `cuprate-rpc-interface` handles that.
|
|
||||||
//
|
|
||||||
// We can assume the request coming has the required permissions.
|
|
||||||
|
|
||||||
let state = CupratedRpcHandler::clone(self);
|
let state = CupratedRpcHandler::clone(self);
|
||||||
|
|
||||||
let resp = match req {
|
let resp = match req {
|
||||||
RpcRequest::JsonRpc(r) => json::map_request(r), // JSON-RPC 2.0 requests.
|
RpcRequest::JsonRpc(r) => json::map_request(state, r), // JSON-RPC 2.0 requests.
|
||||||
RpcRequest::Binary(r) => bin::map_request(r), // Binary requests.
|
RpcRequest::Binary(r) => bin::map_request(state, r), // Binary requests.
|
||||||
RpcRequest::Other(o) => other::map_request(r), // JSON (but not JSON-RPC) requests.
|
RpcRequest::Other(o) => other::map_request(state, r), // JSON (but not JSON-RPC) requests.
|
||||||
};
|
};
|
||||||
|
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
|
|
|
@ -22,7 +22,10 @@ use cuprate_rpc_types::json::{
|
||||||
|
|
||||||
use crate::rpc::CupratedRpcHandler;
|
use crate::rpc::CupratedRpcHandler;
|
||||||
|
|
||||||
async fn map_request(state: CupratedRpcHandler, request: JsonRpcRequest) -> JsonRpcResponse {
|
pub(super) async fn map_request(
|
||||||
|
state: CupratedRpcHandler,
|
||||||
|
request: JsonRpcRequest,
|
||||||
|
) -> JsonRpcResponse {
|
||||||
use JsonRpcRequest as Req;
|
use JsonRpcRequest as Req;
|
||||||
use JsonRpcResponse as Resp;
|
use JsonRpcResponse as Resp;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,10 @@ use cuprate_rpc_types::other::{
|
||||||
|
|
||||||
use crate::rpc::CupratedRpcHandler;
|
use crate::rpc::CupratedRpcHandler;
|
||||||
|
|
||||||
async fn map_request(state: CupratedRpcHandler, request: OtherRpcRequest) -> OtherRpcResponse {
|
pub(super) async fn map_request(
|
||||||
|
state: CupratedRpcHandler,
|
||||||
|
request: OtherRpcRequest,
|
||||||
|
) -> OtherRpcResponse {
|
||||||
use OtherRpcRequest as Req;
|
use OtherRpcRequest as Req;
|
||||||
use OtherRpcResponse as Resp;
|
use OtherRpcResponse as Resp;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue