mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-31 01:58:17 -05:00
Add propagate field to TransactionValidationOutcome (#3664)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@@ -170,6 +170,7 @@ impl<T: PoolTransaction> TransactionValidator for NoopTransactionValidator<T> {
|
||||
balance: Default::default(),
|
||||
state_nonce: 0,
|
||||
transaction,
|
||||
propagate: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,7 +274,12 @@ where
|
||||
tx: TransactionValidationOutcome<T::Transaction>,
|
||||
) -> PoolResult<TxHash> {
|
||||
match tx {
|
||||
TransactionValidationOutcome::Valid { balance, state_nonce, transaction } => {
|
||||
TransactionValidationOutcome::Valid {
|
||||
balance,
|
||||
state_nonce,
|
||||
transaction,
|
||||
propagate,
|
||||
} => {
|
||||
let sender_id = self.get_sender_id(transaction.sender());
|
||||
let transaction_id = TransactionId::new(sender_id, transaction.nonce());
|
||||
let encoded_length = transaction.encoded_length();
|
||||
@@ -282,7 +287,7 @@ where
|
||||
let tx = ValidPoolTransaction {
|
||||
transaction,
|
||||
transaction_id,
|
||||
propagate: false,
|
||||
propagate,
|
||||
timestamp: Instant::now(),
|
||||
origin,
|
||||
encoded_length,
|
||||
|
||||
@@ -311,6 +311,7 @@ where
|
||||
balance: account.balance,
|
||||
state_nonce: account.nonce,
|
||||
transaction,
|
||||
propagate: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ pub enum TransactionValidationOutcome<T: PoolTransaction> {
|
||||
state_nonce: u64,
|
||||
/// Validated transaction.
|
||||
transaction: T,
|
||||
/// Whether to propagate the transaction to the network.
|
||||
propagate: bool,
|
||||
},
|
||||
/// The transaction is considered invalid indefinitely: It violates constraints that prevent
|
||||
/// this transaction from ever becoming valid.
|
||||
|
||||
Reference in New Issue
Block a user