2025-07-14 15:45:20 -03:00
|
|
|
use common::{merkle_tree_public::TreeHashType, transaction::AuthenticatedTransaction};
|
2024-10-10 14:09:31 +03:00
|
|
|
use mempool::mempoolitem::MemPoolItem;
|
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
2025-07-14 15:45:20 -03:00
|
|
|
pub struct MempoolTransaction {
|
|
|
|
|
pub tx: AuthenticatedTransaction,
|
2024-10-10 14:09:31 +03:00
|
|
|
}
|
|
|
|
|
|
2025-07-14 15:45:20 -03:00
|
|
|
impl From<AuthenticatedTransaction> for MempoolTransaction {
|
|
|
|
|
fn from(value: AuthenticatedTransaction) -> Self {
|
2025-04-16 16:17:53 +03:00
|
|
|
Self { tx: value }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-14 15:45:20 -03:00
|
|
|
// impl Serialize for TransactionMempool {
|
|
|
|
|
// fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
|
|
|
|
// where
|
|
|
|
|
// S: serde::Serializer,
|
|
|
|
|
// {
|
|
|
|
|
// self.tx.serialize(serializer)
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// impl<'de> Deserialize<'de> for TransactionMempool {
|
|
|
|
|
// fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
|
|
|
|
// where
|
|
|
|
|
// D: serde::Deserializer<'de>,
|
|
|
|
|
// {
|
|
|
|
|
// match TransactionBody::deserialize(deserializer) {
|
|
|
|
|
// Ok(tx) => Ok(TransactionMempool { tx }),
|
|
|
|
|
// Err(err) => Err(err),
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2024-10-10 14:09:31 +03:00
|
|
|
|
2025-07-14 15:45:20 -03:00
|
|
|
impl MemPoolItem for MempoolTransaction {
|
2024-10-14 13:12:59 +03:00
|
|
|
type Identifier = TreeHashType;
|
2024-10-10 14:09:31 +03:00
|
|
|
|
|
|
|
|
fn identifier(&self) -> Self::Identifier {
|
2025-07-14 15:45:20 -03:00
|
|
|
*self.tx.hash()
|
2024-10-10 14:09:31 +03:00
|
|
|
}
|
|
|
|
|
}
|