chore: genericify some net tx types (#12677)

This commit is contained in:
Matthias Seitz
2024-11-19 19:07:17 +01:00
committed by GitHub
parent 37181c357a
commit 8c467e4291

View File

@ -1449,9 +1449,9 @@ impl PropagationMode {
/// A transaction that's about to be propagated to multiple peers. /// A transaction that's about to be propagated to multiple peers.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
struct PropagateTransaction { struct PropagateTransaction<T = TransactionSigned> {
size: usize, size: usize,
transaction: Arc<TransactionSigned>, transaction: Arc<T>,
} }
// === impl PropagateTransaction === // === impl PropagateTransaction ===
@ -1477,9 +1477,9 @@ impl PropagateTransaction {
/// Helper type to construct the appropriate message to send to the peer based on whether the peer /// Helper type to construct the appropriate message to send to the peer based on whether the peer
/// should receive them in full or as pooled /// should receive them in full or as pooled
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
enum PropagateTransactionsBuilder { enum PropagateTransactionsBuilder<T = TransactionSigned> {
Pooled(PooledTransactionsHashesBuilder), Pooled(PooledTransactionsHashesBuilder),
Full(FullTransactionsBuilder), Full(FullTransactionsBuilder<T>),
} }
impl PropagateTransactionsBuilder { impl PropagateTransactionsBuilder {
@ -1528,11 +1528,11 @@ impl PropagateTransactionsBuilder {
} }
/// Represents how the transactions should be sent to a peer if any. /// Represents how the transactions should be sent to a peer if any.
struct PropagateTransactions { struct PropagateTransactions<T = TransactionSigned> {
/// The pooled transaction hashes to send. /// The pooled transaction hashes to send.
pooled: Option<NewPooledTransactionHashes>, pooled: Option<NewPooledTransactionHashes>,
/// The transactions to send in full. /// The transactions to send in full.
full: Option<Vec<Arc<TransactionSigned>>>, full: Option<Vec<Arc<T>>>,
} }
/// Helper type for constructing the full transaction message that enforces the /// Helper type for constructing the full transaction message that enforces the
@ -1540,11 +1540,11 @@ struct PropagateTransactions {
/// and enforces other propagation rules for EIP-4844 and tracks those transactions that can't be /// and enforces other propagation rules for EIP-4844 and tracks those transactions that can't be
/// broadcasted in full. /// broadcasted in full.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
struct FullTransactionsBuilder { struct FullTransactionsBuilder<T = TransactionSigned> {
/// The soft limit to enforce for a single broadcast message of full transactions. /// The soft limit to enforce for a single broadcast message of full transactions.
total_size: usize, total_size: usize,
/// All transactions to be broadcasted. /// All transactions to be broadcasted.
transactions: Vec<Arc<TransactionSigned>>, transactions: Vec<Arc<T>>,
/// Transactions that didn't fit into the broadcast message /// Transactions that didn't fit into the broadcast message
pooled: PooledTransactionsHashesBuilder, pooled: PooledTransactionsHashesBuilder,
} }