perf: warm transactions in parallel (#13759)

This commit is contained in:
Dan Cline
2025-02-04 11:25:51 -05:00
committed by GitHub
parent 6fecdac4ea
commit b6ce1d90fd
14 changed files with 263 additions and 92 deletions

View File

@ -0,0 +1,23 @@
use alloc::sync::Arc;
use core::sync::atomic::AtomicBool;
/// A marker that can be used to cancel execution.
///
/// If dropped, it will set the `cancelled` flag to true.
#[derive(Default, Clone, Debug)]
pub struct Cancelled(Arc<AtomicBool>);
// === impl Cancelled ===
impl Cancelled {
/// Returns true if the job was cancelled.
pub fn is_cancelled(&self) -> bool {
self.0.load(core::sync::atomic::Ordering::Relaxed)
}
}
impl Drop for Cancelled {
fn drop(&mut self) {
self.0.store(true, core::sync::atomic::Ordering::Relaxed);
}
}

View File

@ -17,6 +17,9 @@ pub mod batch;
/// Database adapters for payload building.
pub mod cached;
/// A marker that can be used to cancel execution.
pub mod cancelled;
/// Contains glue code for integrating reth database into revm's [Database].
pub mod database;