Skip to main content

kaspa_mining/model/
candidate_tx.rs

1use crate::FeerateTransactionKey;
2use kaspa_consensus_core::tx::Transaction;
3use std::sync::Arc;
4
5/// Transaction with additional metadata needed in order to be a candidate
6/// in the transaction selection algorithm
7#[derive(Clone, Debug, PartialEq, Eq)]
8pub struct CandidateTransaction {
9    /// The actual transaction
10    pub tx: Arc<Transaction>,
11    /// Populated fee
12    pub calculated_fee: u64,
13    /// Populated mass
14    pub calculated_mass: u64,
15}
16
17impl CandidateTransaction {
18    pub fn from_key(key: FeerateTransactionKey) -> Self {
19        Self { tx: key.tx, calculated_fee: key.fee, calculated_mass: key.mass }
20    }
21}