Skip to content

Commit

Permalink
feat: add address to debug print chain (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
stringhandler authored Dec 13, 2024
1 parent 5e73183 commit 26085b4
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/server/p2p/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2275,10 +2275,14 @@ where S: ShareChain
}

async fn print_debug_chain_graph(&self) {
self.print_debug_chain_graph_inner(&self.share_chain_random_x, "randomx")
.await;
self.print_debug_chain_graph_inner(&self.share_chain_sha3x, "sha3x")
.await;
if self.config.randomx_enabled {
self.print_debug_chain_graph_inner(&self.share_chain_random_x, "randomx")
.await;
}
if self.config.sha3x_enabled {
self.print_debug_chain_graph_inner(&self.share_chain_sha3x, "sha3x")
.await;
}
}

async fn print_debug_chain_graph_inner(&self, chain: &S, prefix: &str) {
Expand All @@ -2305,12 +2309,14 @@ where S: ShareChain
for b in blocks {
file.write_all(
format!(
"B{} [label=\"{} - {} {}{}\"]\n",
"B{} [label=\"{} - {} {}{} {}..{}\"]\n",
&b.hash.to_hex()[0..8],
&b.height,
&b.hash.to_hex()[0..8],
if b.verified { "" } else { "UNVERIFIED " },
formatter.format(b.target_difficulty().as_u64() as f64)
formatter.format(b.target_difficulty().as_u64() as f64),
&b.miner_wallet_address.to_base58()[0..6],
&b.miner_wallet_address.to_base58()[84..]
)
.as_bytes(),
)
Expand Down

0 comments on commit 26085b4

Please sign in to comment.