mirror of
https://github.com/hinto-janai/cuprate.git
synced 2024-12-22 19:49:33 +00:00
txpool: all_hashes
This commit is contained in:
parent
21e42c1f54
commit
ed8de29504
3 changed files with 35 additions and 0 deletions
|
@ -178,6 +178,27 @@ pub async fn pool_stats(
|
||||||
Ok(txpool_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
|
/// TODO
|
||||||
pub async fn flush(txpool_manager: &mut Infallible, tx_hashes: Vec<[u8; 32]>) -> Result<(), Error> {
|
pub async fn flush(txpool_manager: &mut Infallible, tx_hashes: Vec<[u8; 32]>) -> Result<(), Error> {
|
||||||
todo!();
|
todo!();
|
||||||
|
|
|
@ -73,6 +73,9 @@ pub enum TxpoolReadRequest {
|
||||||
|
|
||||||
/// TODO
|
/// TODO
|
||||||
PoolStats { include_sensitive_txs: bool },
|
PoolStats { include_sensitive_txs: bool },
|
||||||
|
|
||||||
|
/// TODO
|
||||||
|
AllHashes { include_sensitive_txs: bool },
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- TxpoolReadResponse
|
//---------------------------------------------------------------------------------------------------- TxpoolReadResponse
|
||||||
|
@ -130,6 +133,9 @@ pub enum TxpoolReadResponse {
|
||||||
|
|
||||||
/// Response to [`TxpoolReadRequest::PoolStats`].
|
/// Response to [`TxpoolReadRequest::PoolStats`].
|
||||||
PoolStats(TxpoolStats),
|
PoolStats(TxpoolStats),
|
||||||
|
|
||||||
|
/// Response to [`TxpoolReadRequest::AllHashes`].
|
||||||
|
AllHashes(Vec<[u8; 32]>),
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- TxpoolWriteRequest
|
//---------------------------------------------------------------------------------------------------- TxpoolWriteRequest
|
||||||
|
|
|
@ -95,6 +95,9 @@ fn map_request(
|
||||||
TxpoolReadRequest::PoolStats {
|
TxpoolReadRequest::PoolStats {
|
||||||
include_sensitive_txs,
|
include_sensitive_txs,
|
||||||
} => pool_stats(env, 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 {
|
fn pool_stats(env: &ConcreteEnv, include_sensitive_txs: bool) -> ReadResponseResult {
|
||||||
Ok(TxpoolReadResponse::PoolStats(todo!()))
|
Ok(TxpoolReadResponse::PoolStats(todo!()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// [`TxpoolReadRequest::AllHashes`].
|
||||||
|
fn all_hashes(env: &ConcreteEnv, include_sensitive_txs: bool) -> ReadResponseResult {
|
||||||
|
Ok(TxpoolReadResponse::AllHashes(todo!()))
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue