From 03dbd6080f5a4721b017d04e11df2ee4d8299a87 Mon Sep 17 00:00:00 2001 From: Andrew Fitzgerald Date: Fri, 15 Mar 2024 12:11:56 -0700 Subject: [PATCH] add commented out functions - simplify diff --- .../transaction_state.rs | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/core/src/banking_stage/transaction_scheduler/transaction_state.rs b/core/src/banking_stage/transaction_scheduler/transaction_state.rs index c53c60b8aee16b..6cfd483db2b897 100644 --- a/core/src/banking_stage/transaction_scheduler/transaction_state.rs +++ b/core/src/banking_stage/transaction_scheduler/transaction_state.rs @@ -47,6 +47,55 @@ impl TransactionState { } } + /* + /// Returns a reference to the priority details of the transaction. + pub(crate) fn transaction_priority_details(&self) -> &TransactionPriorityDetails { + match self { + Self::Unprocessed { + transaction_priority_details, + .. + } => transaction_priority_details, + Self::Pending { + transaction_priority_details, + .. + } => transaction_priority_details, + } + } + + /// Returns a reference to the transaction cost of the transaction. + pub(crate) fn transaction_cost(&self) -> &TransactionCost { + match self { + Self::Unprocessed { + transaction_cost, .. + } => transaction_cost, + Self::Pending { + transaction_cost, .. + } => transaction_cost, + } + } + + /// Returns the priority of the transaction. + pub(crate) fn priority(&self) -> u64 { + self.transaction_priority_details().priority + } + + /// Returns whether or not the transaction has already been forwarded. + pub(crate) fn forwarded(&self) -> bool { + match self { + Self::Unprocessed { forwarded, .. } => *forwarded, + Self::Pending { forwarded, .. } => *forwarded, + } + } + + /// Sets the transaction as forwarded. + pub(crate) fn set_forwarded(&mut self) { + match self { + Self::Unprocessed { forwarded, .. } => *forwarded = true, + Self::Pending { forwarded, .. } => *forwarded = true, + } + } + */ + /// Return the priority of the transaction. /// This is *not* the same as the `compute_unit_price` of the transaction. /// The priority is used to order transactions for processing.