mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: replace once_cell with std (#11694)
Co-authored-by: Emilia Hane <elsaemiliaevahane@gmail.com>
This commit is contained in:
@ -13,10 +13,14 @@ use alloy_primitives::{Bytes, TxHash};
|
||||
use alloy_rlp::{Decodable, Encodable, Error as RlpError, Header};
|
||||
use core::mem;
|
||||
use derive_more::{AsRef, Deref};
|
||||
use once_cell::sync::Lazy;
|
||||
use once_cell as _;
|
||||
#[cfg(not(feature = "std"))]
|
||||
use once_cell::sync::Lazy as LazyLock;
|
||||
use rayon::prelude::{IntoParallelIterator, ParallelIterator};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use signature::{decode_with_eip155_chain_id, with_eip155_parity};
|
||||
#[cfg(feature = "std")]
|
||||
use std::sync::LazyLock;
|
||||
|
||||
pub use error::{
|
||||
InvalidTransactionError, TransactionConversionError, TryFromRecoveredTransactionError,
|
||||
@ -72,8 +76,8 @@ pub type TxHashOrNumber = BlockHashOrNumber;
|
||||
|
||||
// Expected number of transactions where we can expect a speed-up by recovering the senders in
|
||||
// parallel.
|
||||
pub(crate) static PARALLEL_SENDER_RECOVERY_THRESHOLD: Lazy<usize> =
|
||||
Lazy::new(|| match rayon::current_num_threads() {
|
||||
pub(crate) static PARALLEL_SENDER_RECOVERY_THRESHOLD: LazyLock<usize> =
|
||||
LazyLock::new(|| match rayon::current_num_threads() {
|
||||
0..=1 => usize::MAX,
|
||||
2..=8 => 10,
|
||||
_ => 5,
|
||||
|
||||
Reference in New Issue
Block a user