diff --git a/binaries/cuprated/src/rpc/service/txpool.rs b/binaries/cuprated/src/rpc/service/txpool.rs index e77f89b..7f9b673 100644 --- a/binaries/cuprated/src/rpc/service/txpool.rs +++ b/binaries/cuprated/src/rpc/service/txpool.rs @@ -178,6 +178,27 @@ pub async fn pool_stats( Ok(txpool_stats) } +/// TODO +pub async fn all_hashes( + txpool_read: &mut TxpoolReadHandle, + include_sensitive_txs: bool, +) -> Result<Vec<[u8; 32]>, Error> { + let TxpoolReadResponse::AllHashes(hashes) = txpool_read + .ready() + .await + .map_err(|e| anyhow!(e))? + .call(TxpoolReadRequest::AllHashes { + include_sensitive_txs, + }) + .await + .map_err(|e| anyhow!(e))? + else { + unreachable!(); + }; + + Ok(hashes) +} + /// TODO pub async fn flush(txpool_manager: &mut Infallible, tx_hashes: Vec<[u8; 32]>) -> Result<(), Error> { todo!(); diff --git a/storage/txpool/src/service/interface.rs b/storage/txpool/src/service/interface.rs index 578e6a5..7e6b4d4 100644 --- a/storage/txpool/src/service/interface.rs +++ b/storage/txpool/src/service/interface.rs @@ -73,6 +73,9 @@ pub enum TxpoolReadRequest { /// TODO PoolStats { include_sensitive_txs: bool }, + + /// TODO + AllHashes { include_sensitive_txs: bool }, } //---------------------------------------------------------------------------------------------------- TxpoolReadResponse @@ -130,6 +133,9 @@ pub enum TxpoolReadResponse { /// Response to [`TxpoolReadRequest::PoolStats`]. PoolStats(TxpoolStats), + + /// Response to [`TxpoolReadRequest::AllHashes`]. + AllHashes(Vec<[u8; 32]>), } //---------------------------------------------------------------------------------------------------- TxpoolWriteRequest diff --git a/storage/txpool/src/service/read.rs b/storage/txpool/src/service/read.rs index 844165f..4cd681a 100644 --- a/storage/txpool/src/service/read.rs +++ b/storage/txpool/src/service/read.rs @@ -95,6 +95,9 @@ fn map_request( TxpoolReadRequest::PoolStats { include_sensitive_txs, } => pool_stats(env, include_sensitive_txs), + TxpoolReadRequest::AllHashes { + include_sensitive_txs, + } => all_hashes(env, include_sensitive_txs), } } @@ -268,3 +271,8 @@ fn pool(env: &ConcreteEnv, include_sensitive_txs: bool) -> ReadResponseResult { fn pool_stats(env: &ConcreteEnv, include_sensitive_txs: bool) -> ReadResponseResult { Ok(TxpoolReadResponse::PoolStats(todo!())) } + +/// [`TxpoolReadRequest::AllHashes`]. +fn all_hashes(env: &ConcreteEnv, include_sensitive_txs: bool) -> ReadResponseResult { + Ok(TxpoolReadResponse::AllHashes(todo!())) +}