mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
feat: Exclude private txs for pending block (#6015)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -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();
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user