txpool: collapse TxEntry

This commit is contained in:
hinto.janai 2024-10-30 18:41:42 -04:00
parent aecbdf5728
commit b30b41a4d8
No known key found for this signature in database
GPG key ID: D47CE05FA175A499
3 changed files with 3 additions and 33 deletions

View file

@ -9,7 +9,7 @@ use std::{
use cuprate_types::TransactionVerificationData;
use crate::{
tx::{BlockTemplateTxEntry, TxEntry},
tx::TxEntry,
types::{KeyImage, TransactionBlobHash, TransactionHash},
};
@ -34,12 +34,6 @@ pub enum TxpoolReadRequest {
/// Get information on all transactions in the pool.
Backlog,
/// Get information on all transactions in
/// the pool for block template purposes.
///
/// This is only slightly different to [`TxpoolReadRequest::Backlog`].
BlockTemplateBacklog,
/// Get the number of transactions in the pool.
Size {
/// If this is [`true`], the size returned will
@ -80,11 +74,6 @@ pub enum TxpoolReadResponse {
/// the transactions currently in the pool.
Backlog(Vec<TxEntry>),
/// Response to [`TxpoolReadRequest::BlockTemplateBacklog`].
///
/// The inner [`Vec`] contains information on transactions
BlockTemplateBacklog(Vec<BlockTemplateTxEntry>),
/// Response to [`TxpoolReadRequest::Size`].
///
/// The inner value is the amount of

View file

@ -71,7 +71,6 @@ fn map_request(
}
TxpoolReadRequest::TxsForBlock(txs_needed) => txs_for_block(env, txs_needed),
TxpoolReadRequest::Backlog => backlog(env),
TxpoolReadRequest::BlockTemplateBacklog => block_template_backlog(env),
TxpoolReadRequest::Size {
include_sensitive_txs,
} => size(env, include_sensitive_txs),
@ -202,12 +201,6 @@ fn backlog(env: &ConcreteEnv) -> ReadResponseResult {
Ok(TxpoolReadResponse::Backlog(todo!()))
}
/// [`TxpoolReadRequest::BlockTemplateBacklog`].
#[inline]
fn block_template_backlog(env: &ConcreteEnv) -> ReadResponseResult {
Ok(TxpoolReadResponse::BlockTemplateBacklog(todo!()))
}
/// [`TxpoolReadRequest::Size`].
#[inline]
fn size(env: &ConcreteEnv, include_sensitive_txs: bool) -> ReadResponseResult {

View file

@ -5,6 +5,8 @@
/// Used in [`TxpoolReadResponse::Backlog`](crate::service::interface::TxpoolReadResponse::Backlog).
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub struct TxEntry {
/// The transaction's ID (hash).
pub id: [u8; 32],
/// The transaction's weight.
pub weight: u64,
/// The transaction's fee.
@ -12,17 +14,3 @@ pub struct TxEntry {
/// How long the transaction has been in the pool.
pub time_in_pool: std::time::Duration,
}
/// Data about a transaction in the pool
/// for use in a block template.
///
/// Used in [`TxpoolReadResponse::BlockTemplateBacklog`](crate::service::interface::TxpoolReadResponse::BlockTemplateBacklog).
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub struct BlockTemplateTxEntry {
/// The transaction's ID (hash).
pub id: [u8; 32],
/// The transaction's weight.
pub weight: u64,
/// The transaction's fee.
pub fee: u64,
}