diff --git a/Cargo.toml b/Cargo.toml index aea311c9b..0c42dcdc0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -188,7 +188,7 @@ event-graph = [ "darkfi-serial/collections", "darkfi-serial/hash", - "rpc", + "net", ] p2p-nym = [] diff --git a/src/event_graph/mod.rs b/src/event_graph/mod.rs index 50be1118d..7836aef83 100644 --- a/src/event_graph/mod.rs +++ b/src/event_graph/mod.rs @@ -29,18 +29,22 @@ use smol::{ lock::{OnceCell, RwLock}, Executor, }; -use tinyjson::JsonValue::{self}; use tracing::{debug, error, info, warn}; use crate::{ event_graph::util::replayer_log, net::P2pPtr, - rpc::{ + system::{msleep, Publisher, PublisherPtr, StoppableTask, StoppableTaskPtr, Subscription}, + Error, Result, +}; + +#[cfg(feature = "rpc")] +use { + crate::rpc::{ jsonrpc::{JsonResponse, JsonResult}, util::json_map, }, - system::{msleep, Publisher, PublisherPtr, StoppableTask, StoppableTaskPtr, Subscription}, - Error, Result, + tinyjson::JsonValue::{self}, }; /// An event graph event @@ -803,6 +807,7 @@ impl EventGraph { self.deg_publisher.notify(event).await; } + #[cfg(feature = "rpc")] pub async fn eventgraph_info(&self, id: u16, _params: JsonValue) -> JsonResult { let mut graph = HashMap::new(); for iter_elem in self.dag.iter() { diff --git a/src/event_graph/util.rs b/src/event_graph/util.rs index 518afcbac..952dde1c1 100644 --- a/src/event_graph/util.rs +++ b/src/event_graph/util.rs @@ -17,28 +17,34 @@ */ use std::{ - collections::HashMap, fs::{self, File, OpenOptions}, io::Write, path::Path, time::UNIX_EPOCH, }; -use darkfi_serial::{deserialize, deserialize_async, serialize}; -use sled_overlay::sled; -use tinyjson::JsonValue; -use tracing::error; - use crate::{ event_graph::{Event, GENESIS_CONTENTS, INITIAL_GENESIS, NULL_ID, N_EVENT_PARENTS}, - rpc::{ - jsonrpc::{ErrorCode, JsonError, JsonResponse, JsonResult}, - util::json_map, - }, - util::{encoding::base64, file::load_file}, + util::encoding::base64, Result, }; +#[cfg(feature = "rpc")] +use { + crate::{ + rpc::{ + jsonrpc::{ErrorCode, JsonError, JsonResponse, JsonResult}, + util::json_map, + }, + util::file::load_file, + }, + darkfi_serial::{deserialize, deserialize_async, serialize}, + sled_overlay::sled, + std::collections::HashMap, + tinyjson::JsonValue, + tracing::error, +}; + /// MilliSeconds in a day pub(super) const DAY: i64 = 86_400_000; @@ -148,6 +154,7 @@ pub(super) fn replayer_log(datastore: &Path, cmd: String, value: Vec) -> Res Ok(()) } +#[cfg(feature = "rpc")] pub async fn recreate_from_replayer_log(datastore: &Path) -> JsonResult { let log_path = datastore.join("replayer.log"); if !log_path.exists() {