cfx_packing_pool/
transaction.rs1use std::{fmt::Debug, hash::Hash, sync::Arc};
2
3use cfx_types::{AddressWithSpace, H256, U256};
4use primitives::SignedTransaction;
5
6pub trait PackingPoolTransaction: Clone {
8 type Sender: Default + Ord + Hash + Copy + Debug;
9 fn sender(&self) -> Self::Sender;
10
11 fn nonce(&self) -> U256;
12
13 fn gas_price(&self) -> U256;
14
15 fn gas_limit(&self) -> U256;
16
17 fn hash(&self) -> H256;
18}
19
20impl PackingPoolTransaction for Arc<SignedTransaction> {
21 type Sender = AddressWithSpace;
22
23 #[inline]
24 fn sender(&self) -> AddressWithSpace { SignedTransaction::sender(&self) }
25
26 #[inline]
27 fn nonce(&self) -> U256 { *SignedTransaction::nonce(&self) }
28
29 #[inline]
30 fn gas_price(&self) -> U256 { *SignedTransaction::gas_price(&self) }
31
32 #[inline]
33 fn gas_limit(&self) -> U256 { *SignedTransaction::gas_limit(&self) }
34
35 #[inline]
36 fn hash(&self) -> H256 { SignedTransaction::hash(&self) }
37}