cfxcore/pos/mempool/core_mempool/
transaction.rs1use diem_crypto::HashValue;
9use diem_types::{
10 account_address::AccountAddress, transaction::SignedTransaction,
11};
12use serde::{Deserialize, Serialize};
13use std::time::Duration;
14
15#[derive(Clone)]
16pub struct MempoolTransaction {
17 pub txn: SignedTransaction,
18 pub expiration_time: Duration,
21 pub timeline_state: TimelineState,
22}
23
24impl MempoolTransaction {
25 pub(crate) fn new(
26 txn: SignedTransaction, expiration_time: Duration,
27 timeline_state: TimelineState,
28 ) -> Self {
29 Self {
30 txn,
31 expiration_time,
32 timeline_state,
33 }
34 }
35
36 pub(crate) fn get_hash(&self) -> HashValue { self.txn.hash() }
37
38 pub(crate) fn get_sender(&self) -> AccountAddress { self.txn.sender() }
39}
40
41#[derive(Clone, Copy, PartialEq, Eq, Debug, Deserialize, Hash, Serialize)]
42pub enum TimelineState {
43 Ready(u64),
47 NotReady,
50 NonQualified,
53}