Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: remove archive from initialize trait #3450

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions node/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ pub struct ChainSrv<N: Network, DB: database::DB, VM: vm::VMExecution> {
event_sender: Sender<Event>,
genesis_timestamp: u64,
dusk_key: BlsPublicKey,

#[cfg(feature = "archive")]
archive: Archive,
}

#[async_trait]
Expand All @@ -72,7 +75,6 @@ impl<N: Network, DB: database::DB, VM: vm::VMExecution>
network: Arc<RwLock<N>>,
db: Arc<RwLock<DB>>,
vm: Arc<RwLock<VM>>,
#[cfg(feature = "archive")] archive: Archive,
) -> anyhow::Result<()> {
let tip = Self::load_tip(
db.read().await.deref(),
Expand All @@ -93,7 +95,7 @@ impl<N: Network, DB: database::DB, VM: vm::VMExecution>
network,
vm,
#[cfg(feature = "archive")]
archive,
self.archive.clone(),
self.max_consensus_queue_size,
self.event_sender.clone(),
self.dusk_key,
Expand Down Expand Up @@ -256,6 +258,7 @@ impl<N: Network, DB: database::DB, VM: vm::VMExecution> ChainSrv<N, DB, VM> {
event_sender: Sender<Event>,
genesis_timestamp: u64,
dusk_key: BlsPublicKey,
#[cfg(feature = "archive")] archive: Archive,
) -> Self {
info!(
"ChainSrv::new with keys_path: {}, max_inbound_size: {}",
Expand All @@ -270,6 +273,8 @@ impl<N: Network, DB: database::DB, VM: vm::VMExecution> ChainSrv<N, DB, VM> {
event_sender,
genesis_timestamp,
dusk_key,
#[cfg(feature = "archive")]
archive,
}
}

Expand Down
6 changes: 0 additions & 6 deletions node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ use std::net::SocketAddr;
use std::sync::Arc;
use std::time::{Duration, Instant};

#[cfg(feature = "archive")]
use archive::Archive;
use async_trait::async_trait;
use node_data::message::payload::Inv;
use node_data::message::{AsyncQueue, Message};
Expand Down Expand Up @@ -120,7 +118,6 @@ pub trait LongLivedService<N: Network, DB: database::DB, VM: vm::VMExecution>:
network: Arc<RwLock<N>>,
database: Arc<RwLock<DB>>,
vm: Arc<RwLock<VM>>,
#[cfg(feature = "archive")] achive: Archive,
) -> anyhow::Result<()> {
Ok(())
}
Expand Down Expand Up @@ -192,7 +189,6 @@ impl<N: Network, DB: database::DB, VM: vm::VMExecution> Node<N, DB, VM> {
pub async fn initialize(
&self,
services: &mut [Box<dyn LongLivedService<N, DB, VM>>],
#[cfg(feature = "archive")] archive: Archive,
) -> anyhow::Result<()> {
// Run lazy-initialization of all registered services
for service in services.iter_mut() {
Expand All @@ -202,8 +198,6 @@ impl<N: Network, DB: database::DB, VM: vm::VMExecution> Node<N, DB, VM> {
self.network.clone(),
self.database.clone(),
self.vm_handler.clone(),
#[cfg(feature = "archive")]
archive.clone(),
)
.await?;
}
Expand Down
12 changes: 3 additions & 9 deletions rusk/src/lib/builder/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,15 @@ impl RuskNodeBuilder {
node_sender.clone(),
self.genesis_timestamp,
*crate::DUSK_CONSENSUS_KEY,
#[cfg(feature = "archive")]
archive.clone(),
);
if self.command_revert {
chain_srv
.initialize(
node.inner().network(),
node.inner().database(),
node.inner().vm_handler(),
#[cfg(feature = "archive")]
archive,
)
.await?;
return chain_srv.revert_last_final().await;
Expand Down Expand Up @@ -291,13 +291,7 @@ impl RuskNodeBuilder {
archivist: archive.clone(),
}));

node.inner()
.initialize(
&mut service_list,
#[cfg(feature = "archive")]
archive,
)
.await?;
node.inner().initialize(&mut service_list).await?;
node.inner().spawn_all(service_list).await?;

Ok(())
Expand Down
Loading