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

fix: dag and dag-svg feature mismatch #1739

Merged
merged 1 commit into from
May 21, 2024
Merged
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
10 changes: 5 additions & 5 deletions sn_auditor/src/dag_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

use bls::SecretKey;
use color_eyre::eyre::{eyre, Result};
#[cfg(feature = "svg")]
#[cfg(feature = "svg-dag")]
use graphviz_rust::{cmd::Format, exec, parse, printer::PrinterContext};
use serde::{Deserialize, Serialize};
use sn_client::networking::NetworkError;
Expand Down Expand Up @@ -147,7 +147,7 @@ impl SpendDagDb {
}

/// Dump current DAG as svg to disk
#[cfg(feature = "svg")]
#[cfg(feature = "svg-dag")]
pub fn dump_dag_svg(&self) -> Result<()> {
info!("Dumping DAG to svg...");
std::fs::create_dir_all(&self.path)?;
Expand Down Expand Up @@ -189,7 +189,7 @@ impl SpendDagDb {
*w_handle = dag;
std::mem::drop(w_handle);

#[cfg(feature = "svg")]
#[cfg(feature = "svg-dag")]
{
// update and save svg to file in a background thread so we don't block
//
Expand Down Expand Up @@ -327,7 +327,7 @@ pub async fn new_dag_with_genesis_only(client: &Client) -> Result<SpendDag> {
Ok(dag)
}

#[cfg(feature = "svg")]
#[cfg(feature = "svg-dag")]
fn dag_to_svg(dag: &SpendDag) -> Result<Vec<u8>> {
let dot = dag.dump_dot_format();
let graph = parse(&dot).map_err(|err| eyre!("Failed to parse dag from dot: {err}"))?;
Expand All @@ -347,7 +347,7 @@ fn dag_to_svg(dag: &SpendDag) -> Result<Vec<u8>> {
// - marks poisoned spends as red
// - marks UTXOs and unknown ancestors as yellow
// - just pray it works on windows
#[cfg(feature = "svg")]
#[cfg(feature = "svg-dag")]
fn quick_edit_svg(svg: Vec<u8>, dag: &SpendDag) -> Result<Vec<u8>> {
let mut str = String::from_utf8(svg).map_err(|err| eyre!("Failed svg conversion: {err}"))?;

Expand Down
4 changes: 2 additions & 2 deletions sn_auditor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async fn main() -> Result<()> {

if let Some(dag_to_view) = opt.offline_viewer {
let dag = SpendDagDb::offline(dag_to_view, sk)?;
#[cfg(feature = "svg")]
#[cfg(feature = "svg-dag")]
{
dag.dump_dag_svg()?;
}
Expand Down Expand Up @@ -211,7 +211,7 @@ async fn initialize_background_spend_dag_collection(
}

// initialize svg
#[cfg(feature = "svg")]
#[cfg(feature = "svg-dag")]
dag.dump_dag_svg()?;

// initialize beta rewards program tracking
Expand Down
Loading