openmina_core/transaction/
mod.rs1mod transaction_info;
2pub use transaction_info::TransactionInfo;
3
4mod transaction_with_hash;
5pub use transaction_with_hash::*;
6
7pub use mina_p2p_messages::v2::{MinaBaseUserCommandStableV2 as Transaction, TransactionHash};
8
9use crate::{p2p::P2pNetworkPubsubMessageCacheId, requests::RpcId};
10
11#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Copy, Default)]
13pub enum TransactionPoolMessageSource {
14 Rpc {
15 id: RpcId,
16 },
17 Pubsub {
18 id: P2pNetworkPubsubMessageCacheId,
19 },
20 #[default]
21 None,
22}
23
24impl TransactionPoolMessageSource {
25 pub fn rpc(id: RpcId) -> Self {
26 Self::Rpc { id }
27 }
28
29 pub fn pubsub(id: P2pNetworkPubsubMessageCacheId) -> Self {
30 Self::Pubsub { id }
31 }
32
33 pub fn is_sender_local(&self) -> bool {
34 matches!(self, Self::Rpc { .. })
35 }
36
37 pub fn is_libp2p(&self) -> bool {
38 matches!(self, Self::Pubsub { .. })
39 }
40}