refactor: replace once_cell Lazy with LazyLock (#9844)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Co-authored-by: Oliver <onbjerg@users.noreply.github.com>
This commit is contained in:
Harsh Pratap Singh
2024-08-08 19:50:42 +05:30
committed by GitHub
parent a206eb3690
commit 106a0c7cf7
17 changed files with 26 additions and 33 deletions

View File

@ -20,4 +20,3 @@ futures.workspace = true
tokio.workspace = true
eyre.workspace = true
once_cell.workspace = true

View File

@ -9,7 +9,6 @@
use std::time::Duration;
use futures::StreamExt;
use once_cell::sync::Lazy;
use reth_chainspec::{Chain, MAINNET};
use reth_discv4::{DiscoveryUpdate, Discv4, Discv4ConfigBuilder, DEFAULT_DISCOVERY_ADDRESS};
use reth_ecies::stream::ECIESStream;
@ -20,12 +19,13 @@ use reth_network::config::rng_secret_key;
use reth_network_peers::{mainnet_nodes, pk2id, NodeRecord};
use reth_primitives::{EthereumHardfork, Head, MAINNET_GENESIS_HASH};
use secp256k1::{SecretKey, SECP256K1};
use std::sync::LazyLock;
use tokio::net::TcpStream;
type AuthedP2PStream = P2PStream<ECIESStream<TcpStream>>;
type AuthedEthStream = EthStream<P2PStream<ECIESStream<TcpStream>>>;
pub static MAINNET_BOOT_NODES: Lazy<Vec<NodeRecord>> = Lazy::new(mainnet_nodes);
pub static MAINNET_BOOT_NODES: LazyLock<Vec<NodeRecord>> = LazyLock::new(mainnet_nodes);
#[tokio::main]
async fn main() -> eyre::Result<()> {