feat: Exclude private txs for pending block (#6015)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Supernovahs.eth
2024-01-11 13:42:32 +05:30
committed by GitHub
parent 4660da4a3f
commit 6430731fff
2 changed files with 18 additions and 1 deletions

View File

@ -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();

View File

@ -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