diff --git a/crates/rpc/rpc/src/eth/api/pending_block.rs b/crates/rpc/rpc/src/eth/api/pending_block.rs index 32c2fdc252..8ab260dc62 100644 --- a/crates/rpc/rpc/src/eth/api/pending_block.rs +++ b/crates/rpc/rpc/src/eth/api/pending_block.rs @@ -101,6 +101,14 @@ impl PendingBlockEnv { continue } + if pool_tx.origin.is_private() { + // we don't want to leak any state changes made by private transactions, so we mark + // them as invalid here which removes all dependent transactions from the iterator + // before we can continue + best_txs.mark_invalid(&pool_tx); + continue; + } + // convert tx to a signed transaction let tx = pool_tx.to_recovered_transaction(); diff --git a/crates/transaction-pool/src/traits.rs b/crates/transaction-pool/src/traits.rs index 70875cd0fd..1eef5ac858 100644 --- a/crates/transaction-pool/src/traits.rs +++ b/crates/transaction-pool/src/traits.rs @@ -523,9 +523,18 @@ pub enum TransactionOrigin { impl TransactionOrigin { /// Whether the transaction originates from a local source. - pub fn is_local(&self) -> bool { + pub const fn is_local(&self) -> bool { matches!(self, TransactionOrigin::Local) } + + /// Whether the transaction originates from an external source. + pub const fn is_external(&self) -> bool { + matches!(self, TransactionOrigin::External) + } + /// Whether the transaction originates from a private source. + pub const fn is_private(&self) -> bool { + matches!(self, TransactionOrigin::Private) + } } /// Represents changes after a new canonical block or range of canonical blocks was added to the