Skip to content

Commit

Permalink
fix: dag and dag-svg feature mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
grumbach committed May 20, 2024
1 parent c63a34f commit 83f93aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
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

0 comments on commit 83f93aa

Please sign in to comment.