diff --git a/binaries/cuprated/src/rpc/json.rs b/binaries/cuprated/src/rpc/json.rs index 359486b9..a370156f 100644 --- a/binaries/cuprated/src/rpc/json.rs +++ b/binaries/cuprated/src/rpc/json.rs @@ -48,6 +48,8 @@ use crate::rpc::{ CupratedRpcHandler, }; +use super::request::txpool; + /// Map a [`JsonRpcRequest`] to the function that will lead to a [`JsonRpcResponse`]. pub(super) async fn map_request( state: CupratedRpcHandler, @@ -497,7 +499,14 @@ async fn flush_transaction_pool( state: CupratedRpcHandler, request: FlushTransactionPoolRequest, ) -> Result { - todo!(); + let tx_hashes = request + .txids + .into_iter() + .map(helper::hex_to_hash) + .collect::, _>>()?; + + txpool::flush(tx_hashes).await?; + Ok(FlushTransactionPoolResponse { status: Status::Ok }) } diff --git a/binaries/cuprated/src/rpc/request/txpool.rs b/binaries/cuprated/src/rpc/request/txpool.rs index eef2a474..952cbbcc 100644 --- a/binaries/cuprated/src/rpc/request/txpool.rs +++ b/binaries/cuprated/src/rpc/request/txpool.rs @@ -49,11 +49,7 @@ pub(crate) async fn size(txpool_read: &mut TxpoolReadHandle) -> Result, -) -> Result<(), Error> { +pub(crate) async fn flush(tx_hashes: Vec<[u8; 32]>) -> Result<(), Error> { todo!(); Ok(()) }