mirror of
https://github.com/hinto-janai/cuprate.git
synced 2024-12-22 19:49:33 +00:00
txpool: collapse TxEntry
This commit is contained in:
parent
aecbdf5728
commit
b30b41a4d8
3 changed files with 3 additions and 33 deletions
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue