Skip to content

Commit

Permalink
Merge branch 'stringhandler:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
stringhandler authored Sep 9, 2024
2 parents fb10480 + 4de4a47 commit 087a5b4
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ mod p2pool_client;
mod stats_store;
mod tari_coinbase;

const LOG_TARGET: &str = "tari::universe::gpu_miner";//TODO set log target
const LOG_TARGET: &str = "tari::universe::gpu_miner"; //TODO set log target

#[tokio::main]
async fn main() {
Expand Down Expand Up @@ -120,7 +120,7 @@ async fn main_inner() -> Result<(), anyhow::Error> {
Ok(config) => {
info!(target: LOG_TARGET, "Config file loaded successfully");
config
}
},
Err(err) => {
error!(target: LOG_TARGET, "Error loading config file: {}. Creating new one", err);
let default = ConfigFile::default();
Expand Down Expand Up @@ -170,8 +170,8 @@ async fn main_inner() -> Result<(), anyhow::Error> {
let stats_store = Arc::new(StatsStore::new());
if config.http_server_enabled {
let http_server_config = Config::new(config.http_server_port);
info!(target: LOG_TARGET, "HTTP server runs on port: {}", &http_server_config.port);
let http_server = HttpServer::new(shutdown.to_signal(), http_server_config, stats_store.clone());
info!(target: LOG_TARGET, "HTTP server runs on port: {}", http_server_config.port);
tokio::spawn(async move {
if let Err(error) = http_server.start().await {
println!("Failed to start HTTP server: {error:?}");
Expand Down Expand Up @@ -382,32 +382,32 @@ async fn get_template(
info!(target: LOG_TARGET, "Tari address {}", address.to_string());
let key_manager = create_memory_db_key_manager()?;
let consensus_manager = ConsensusManager::builder(Network::NextNet)
.build()
.expect("Could not build consensus manager");
.build()
.expect("Could not build consensus manager");

let mut lock = node_client.write().await;
let mut lock = node_client.write().await;

// p2pool enabled
if config.p2pool_enabled {
info!(target: LOG_TARGET, "p2pool enabled");
let block_result = lock.get_new_block(NewBlockTemplate::default()).await?;
let block = block_result.result.block.unwrap();
// p2pool enabled
if config.p2pool_enabled {
info!(target: LOG_TARGET, "p2pool enabled");
let block_result = lock.get_new_block(NewBlockTemplate::default()).await?;
let block = block_result.result.block.unwrap();
let mut header: BlockHeader = block
.clone()
.header
.unwrap()
.clone()
.header
.unwrap()
.try_into()
.map_err(|s: String| anyhow!(s))?;
let mining_hash = header.mining_hash().clone();
info!(target: LOG_TARGET,
info!(target: LOG_TARGET,
"block result target difficulty: {}, block timestamp: {}, mining_hash: {}",
block_result.target_difficulty.to_string(),
block.clone().header.unwrap().timestamp.to_string(),
header.mining_hash().clone().to_string()
);
return Ok((block_result.target_difficulty, block, header, mining_hash));
}

println!("Getting block template");
info!(target: LOG_TARGET, "Getting block template");
let template = lock.get_block_template().await?;
Expand Down

0 comments on commit 087a5b4

Please sign in to comment.