mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix(net): syncing should be true at startup (#2395)
This commit is contained in:
@ -57,7 +57,7 @@ impl NetworkHandle {
|
||||
peers,
|
||||
network_mode,
|
||||
bandwidth_meter,
|
||||
is_syncing: Arc::new(Default::default()),
|
||||
is_syncing: Arc::new(AtomicBool::new(true)),
|
||||
chain_id,
|
||||
};
|
||||
Self { inner: Arc::new(inner) }
|
||||
|
||||
@ -3,6 +3,7 @@ use reth_network::{
|
||||
error::{NetworkError, ServiceKind},
|
||||
Discovery, NetworkConfigBuilder, NetworkManager,
|
||||
};
|
||||
use reth_network_api::NetworkInfo;
|
||||
use reth_provider::test_utils::NoopProvider;
|
||||
use secp256k1::SecretKey;
|
||||
use std::{
|
||||
@ -19,6 +20,17 @@ fn is_addr_in_use_kind(err: NetworkError, kind: ServiceKind) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn test_is_default_syncing() {
|
||||
let secret_key = SecretKey::new(&mut rand::thread_rng());
|
||||
let config = NetworkConfigBuilder::new(secret_key)
|
||||
.disable_discovery()
|
||||
.listener_port(0)
|
||||
.build(NoopProvider::default());
|
||||
let network = NetworkManager::new(config).await.unwrap();
|
||||
assert!(network.handle().is_syncing());
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn test_listener_addr_in_use() {
|
||||
let secret_key = SecretKey::new(&mut rand::thread_rng());
|
||||
|
||||
Reference in New Issue
Block a user