Skip to content

Commit

Permalink
chore: genericify some net tx types (#12677)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Nov 19, 2024
1 parent 37181c3 commit 8c467e4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions crates/net/network/src/transactions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1449,9 +1449,9 @@ impl PropagationMode {

/// A transaction that's about to be propagated to multiple peers.
#[derive(Debug, Clone)]
struct PropagateTransaction {
struct PropagateTransaction<T = TransactionSigned> {
size: usize,
transaction: Arc<TransactionSigned>,
transaction: Arc<T>,
}

// === impl PropagateTransaction ===
Expand All @@ -1477,9 +1477,9 @@ impl PropagateTransaction {
/// 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
#[derive(Debug, Clone)]
enum PropagateTransactionsBuilder {
enum PropagateTransactionsBuilder<T = TransactionSigned> {
Pooled(PooledTransactionsHashesBuilder),
Full(FullTransactionsBuilder),
Full(FullTransactionsBuilder<T>),
}

impl PropagateTransactionsBuilder {
Expand Down Expand Up @@ -1528,23 +1528,23 @@ impl PropagateTransactionsBuilder {
}

/// Represents how the transactions should be sent to a peer if any.
struct PropagateTransactions {
struct PropagateTransactions<T = TransactionSigned> {
/// The pooled transaction hashes to send.
pooled: Option<NewPooledTransactionHashes>,
/// 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
/// [`DEFAULT_SOFT_LIMIT_BYTE_SIZE_TRANSACTIONS_BROADCAST_MESSAGE`] for full transaction broadcast
/// and enforces other propagation rules for EIP-4844 and tracks those transactions that can't be
/// broadcasted in full.
#[derive(Debug, Clone)]
struct FullTransactionsBuilder {
struct FullTransactionsBuilder<T = TransactionSigned> {
/// The soft limit to enforce for a single broadcast message of full transactions.
total_size: usize,
/// All transactions to be broadcasted.
transactions: Vec<Arc<TransactionSigned>>,
transactions: Vec<Arc<T>>,
/// Transactions that didn't fit into the broadcast message
pooled: PooledTransactionsHashesBuilder,
}
Expand Down

0 comments on commit 8c467e4

Please sign in to comment.