mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-29 09:08:05 -05:00
(feat):add private variant in tx origin (#4059)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@@ -188,7 +188,11 @@ impl<T: PoolTransaction> TransactionValidator for MockTransactionValidator<T> {
|
||||
balance: Default::default(),
|
||||
state_nonce: 0,
|
||||
transaction,
|
||||
propagate: if origin.is_local() { self.propagate_local } else { true },
|
||||
propagate: match origin {
|
||||
TransactionOrigin::External => true,
|
||||
TransactionOrigin::Local => self.propagate_local,
|
||||
TransactionOrigin::Private => false,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,6 +404,11 @@ pub enum TransactionOrigin {
|
||||
/// This is usually considered an "untrusted" source, for example received from another in the
|
||||
/// network.
|
||||
External,
|
||||
/// Transaction is originated locally and is intended to remain private.
|
||||
///
|
||||
/// This type of transaction should not be propagated to the network. It's meant for
|
||||
/// private usage within the local node only.
|
||||
Private,
|
||||
}
|
||||
|
||||
// === impl TransactionOrigin ===
|
||||
|
||||
@@ -461,8 +461,11 @@ where
|
||||
state_nonce: account.nonce,
|
||||
transaction,
|
||||
// by this point assume all external transactions should be propagated
|
||||
propagate: matches!(origin, TransactionOrigin::External) ||
|
||||
self.propagate_local_transactions,
|
||||
propagate: match origin {
|
||||
TransactionOrigin::External => true,
|
||||
TransactionOrigin::Local => self.propagate_local_transactions,
|
||||
TransactionOrigin::Private => false,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user