diff --git a/src/app/panels/middle/node.rs b/src/app/panels/middle/node.rs index 767f51d..648c330 100644 --- a/src/app/panels/middle/node.rs +++ b/src/app/panels/middle/node.rs @@ -20,7 +20,7 @@ use crate::app::panels::middle::common::header_tab::header_tab; use crate::app::panels::middle::common::state_edit_field::{path_db_field, slider_state_field}; use crate::app::panels::middle::{rpc_bind_field, rpc_port_field, zmq_bind_field, zmq_port_field}; use crate::{ - NODE_DNS_BLOCKLIST, NODE_DNS_CHECKPOINT, NODE_INPUT, NODE_PRUNNING, NODE_URL, + NODE_DNS_BLOCKLIST, NODE_DNS_CHECKPOINT, NODE_FULL_MEM, NODE_INPUT, NODE_PRUNNING, NODE_URL, START_OPTIONS_HOVER, }; use egui::TextStyle; @@ -99,6 +99,9 @@ impl Node { ui.separator(); ui.checkbox(&mut self.disable_dns_checkpoint, "DNS checkpoint") .on_hover_text(NODE_DNS_CHECKPOINT); + ui.separator(); + ui.checkbox(&mut self.full_memory, "Fast Mode") + .on_hover_text(NODE_FULL_MEM); }); }); diff --git a/src/disk/state.rs b/src/disk/state.rs index 04d6fef..69627f0 100644 --- a/src/disk/state.rs +++ b/src/disk/state.rs @@ -338,6 +338,7 @@ pub struct Node { pub dns_blocklist: bool, pub disable_dns_checkpoint: bool, pub path_db: String, + pub full_memory: bool, pub console_height: u32, } @@ -357,6 +358,7 @@ impl Default for Node { dns_blocklist: true, disable_dns_checkpoint: true, path_db: String::new(), + full_memory: false, console_height: APP_DEFAULT_CONSOLE_HEIGHT, } } diff --git a/src/helper/node.rs b/src/helper/node.rs index fc464f0..fc1fc5e 100644 --- a/src/helper/node.rs +++ b/src/helper/node.rs @@ -28,6 +28,7 @@ use std::{ thread, time::{Duration, Instant}, }; +use sysinfo::MemoryRefreshKind; use tokio::spawn; use crate::{ @@ -239,6 +240,16 @@ impl Helper { debug!("Node | Creating command..."); let mut cmd = portable_pty::cmdbuilder::CommandBuilder::new(path.clone()); cmd.args(args); + // if in simple state and enough free memory, enable full memory env + if state.simple { + let mut sys = sysinfo::System::new(); + sys.refresh_memory_specifics(MemoryRefreshKind::nothing().with_ram()); + if sys.available_memory() > 4_000_000_000 { + cmd.env("MONERO_RANDOMX_FULL_MEM", "1"); + } + } else if state.full_memory { + cmd.env("MONERO_RANDOMX_FULL_MEM", "1"); + } cmd.cwd(path.as_path().parent().unwrap()); // 1c. Create child debug!("Node | Creating child..."); diff --git a/src/utils/constants.rs b/src/utils/constants.rs index 493cfb9..684d836 100644 --- a/src/utils/constants.rs +++ b/src/utils/constants.rs @@ -476,6 +476,7 @@ pub const NODE_API_BIND: &str = "bind address of RPC API"; pub const NODE_API_PORT: &str = "RPC API listen port"; pub const NODE_ZMQ_BIND: &str = "bind address of ZMQ API"; pub const NODE_ZMQ_PORT: &str = "ZMQ API listen port"; +pub const NODE_FULL_MEM: &str = "Use 2GB of RAM insteal of 256MB for faster block verification"; // XMRig pub const XMRIG_API_PORT_DEFAULT: u16 = 18088; pub const XMRIG_SIMPLE: &str = r#"Use simple XMRig settings: