Skip to content

Commit

Permalink
Merge remote-tracking branch 'uni/main' into chore/perf
Browse files Browse the repository at this point in the history
  • Loading branch information
shanimal08 committed Jan 21, 2025
2 parents e278aa1 + 1b79664 commit fb5f1f4
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 173 deletions.
84 changes: 42 additions & 42 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ libsqlite3-sys = { version = "0.25.1", features = [
] } # Required for tari_wallet
log = "0.4.22"
log4rs = "1.3.0"
minotari_node_grpc_client = { git = "https://github.com/tari-project/tari.git", tag = "v1.9.1-rc.1" }
minotari_wallet_grpc_client = { git = "https://github.com/tari-project/tari.git", tag = "v1.9.1-rc.1" }
minotari_node_grpc_client = { git = "https://github.com/tari-project/tari.git", tag = "v1.10.0-rc.1" }
minotari_wallet_grpc_client = { git = "https://github.com/tari-project/tari.git", tag = "v1.10.0-rc.1" }
monero-address-creator = { git = "https://github.com/tari-project/monero-address-creator.git", rev = "6129ca0" }
nix = { version = "0.29.0", features = ["signal"] }
nvml-wrapper = "0.10.0"
Expand All @@ -58,15 +58,15 @@ sha2 = "0.10.8"
sys-locale = "0.3.1"
sysinfo = "0.31.2"
tar = "0.4.26"
tari_common = { git = "https://github.com/tari-project/tari.git", tag = "v1.9.1-rc.1" }
tari_common_types = { git = "https://github.com/tari-project/tari.git", tag = "v1.9.1-rc.1" }
tari_core = { git = "https://github.com/tari-project/tari.git", tag = "v1.9.1-rc.1", features = [
tari_common = { git = "https://github.com/tari-project/tari.git", tag = "v1.10.0-rc.1" }
tari_common_types = { git = "https://github.com/tari-project/tari.git", tag = "v1.10.0-rc.1" }
tari_core = { git = "https://github.com/tari-project/tari.git", tag = "v1.10.0-rc.1", features = [
"transactions",
] }
tauri-plugin-single-instance = '2'
tari_crypto = "0.21.0"
tari_key_manager = { git = "https://github.com/tari-project/tari.git", tag = "v1.9.1-rc.1" }
tari_shutdown = { git = "https://github.com/tari-project/tari.git", tag = "v1.9.1-rc.1" }
tari_key_manager = { git = "https://github.com/tari-project/tari.git", tag = "v1.10.0-rc.1" }
tari_shutdown = { git = "https://github.com/tari-project/tari.git", tag = "v1.10.0-rc.1" }
tari_utilities = "0.8.0"
tauri = { version = "2", features = [
"isolation",
Expand Down
6 changes: 3 additions & 3 deletions src-tauri/binaries_versions_esmeralda.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"binaries": {
"xmrig": "=6.22.0",
"mmproxy": "=1.9.2-pre.0",
"minotari_node": "=1.9.2-pre.0",
"wallet": "=1.9.2-pre.0",
"mmproxy": "=1.10.0-pre.1",
"minotari_node": "=1.10.0-pre.1",
"wallet": "=1.10.0-pre.1",
"sha-p2pool": "=0.20.0",
"xtrgpuminer": "=0.2.10",
"tor": "=13.5.7"
Expand Down
6 changes: 3 additions & 3 deletions src-tauri/binaries_versions_nextnet.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"binaries": {
"xmrig": "=6.22.0",
"mmproxy": "=1.9.2-rc.0",
"minotari_node": "=1.9.2-rc.0",
"wallet": "=1.9.2-rc.0",
"mmproxy": "=1.10.0-rc.1",
"minotari_node": "=1.10.0-rc.1",
"wallet": "=1.10.0-rc.1",
"sha-p2pool": "=0.20.0",
"xtrgpuminer": "=0.2.10",
"tor": "=13.5.7"
Expand Down
30 changes: 19 additions & 11 deletions src-tauri/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use crate::wallet_adapter::{TransactionInfo, WalletBalance};
use crate::wallet_manager::WalletManagerError;
use crate::{node_adapter, UniverseAppState, APPLICATION_FOLDER_ID};

use crate::node_adapter::BaseNodeState;
use base64::prelude::*;
use keyring::Entry;
use log::{debug, error, info, warn};
Expand Down Expand Up @@ -102,6 +103,14 @@ pub struct MinerMetrics {
base_node: BaseNodeStatus,
}

impl MinerMetrics {
/// Returns `true` if the base node has state `BaseNodeState::Listening`
#[allow(dead_code)]
pub fn is_synced(&self) -> bool {
self.base_node.base_node_state == BaseNodeState::Listening
}
}

#[derive(Debug, Serialize, Clone)]
pub struct TariWalletDetails {
wallet_balance: Option<WalletBalance>,
Expand All @@ -113,10 +122,13 @@ pub struct TariWalletDetails {
pub struct BaseNodeStatus {
block_height: u64,
block_time: u64,
is_synced: bool,
initial_sync_achieved: bool,
base_node_state: BaseNodeState,
failed_checkpoints: bool,
is_connected: bool,
connected_peers: Vec<String>,
}

#[derive(Debug, Serialize, Clone)]
pub struct CpuMinerStatus {
pub is_mining: bool,
Expand Down Expand Up @@ -401,17 +413,11 @@ pub async fn get_miner_metrics(
randomx_network_hashrate,
block_height,
block_time,
is_synced,
initial_sync_achieved,
block_reward,
base_node_state,
failed_checkpoints,
} = node_status;
// let (sha_hash_rate, randomx_hash_rate, block_reward, block_height, block_time, is_synced) = state.node_manager
// .get_network_hash_rate_and_block_reward().await
// .unwrap_or_else(|e| {
// if !matches!(e, NodeManagerError::NodeNotStarted) {
// warn!(target: LOG_TARGET, "Error getting network hash rate and block reward: {}", e);
// }
// (0, 0, MicroMinotari(0), 0, 0, false)
// });

let cpu_miner = state.cpu_miner.read().await;
let cpu_mining_status = match cpu_miner
Expand Down Expand Up @@ -466,7 +472,9 @@ pub async fn get_miner_metrics(
base_node: BaseNodeStatus {
block_height,
block_time,
is_synced,
initial_sync_achieved,
base_node_state,
failed_checkpoints,
is_connected: !connected_peers.is_empty(),
connected_peers,
},
Expand Down
Loading

0 comments on commit fb5f1f4

Please sign in to comment.