From 26085b4fd45dc8267528911a85e46a905eefcef1 Mon Sep 17 00:00:00 2001 From: stringhandler Date: Fri, 13 Dec 2024 08:01:17 +0200 Subject: [PATCH] feat: add address to debug print chain (#226) --- src/server/p2p/network.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/server/p2p/network.rs b/src/server/p2p/network.rs index 7f36df0..35995a4 100644 --- a/src/server/p2p/network.rs +++ b/src/server/p2p/network.rs @@ -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) { @@ -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(), )