mirror of
https://github.com/Cuprate/cuprate.git
synced 2025-01-11 13:25:09 +00:00
flush_transaction_pool
This commit is contained in:
parent
c7ae795837
commit
6af977f0a5
2 changed files with 11 additions and 6 deletions
|
@ -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<FlushTransactionPoolResponse, Error> {
|
||||
todo!();
|
||||
let tx_hashes = request
|
||||
.txids
|
||||
.into_iter()
|
||||
.map(helper::hex_to_hash)
|
||||
.collect::<Result<Vec<[u8; 32]>, _>>()?;
|
||||
|
||||
txpool::flush(tx_hashes).await?;
|
||||
|
||||
Ok(FlushTransactionPoolResponse { status: Status::Ok })
|
||||
}
|
||||
|
||||
|
|
|
@ -49,11 +49,7 @@ pub(crate) async fn size(txpool_read: &mut TxpoolReadHandle) -> Result<u64, Erro
|
|||
}
|
||||
|
||||
/// TODO
|
||||
#[expect(clippy::needless_pass_by_ref_mut, reason = "TODO: remove after impl")]
|
||||
pub(crate) async fn flush(
|
||||
txpool_read: &mut TxpoolReadHandle,
|
||||
tx_hashes: Vec<[u8; 32]>,
|
||||
) -> Result<(), Error> {
|
||||
pub(crate) async fn flush(tx_hashes: Vec<[u8; 32]>) -> Result<(), Error> {
|
||||
todo!();
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue