mirror of
https://github.com/jwinterm/grim.git
synced 2026-10-21 15:38:32 +02:00
stratum: fix wallet name after selection, do not panic after stop
This commit is contained in:
@@ -25,27 +25,17 @@ use crate::gui::views::network::NetworkContent;
|
||||
use crate::gui::views::network::setup::StratumSetup;
|
||||
use crate::gui::views::network::types::{NodeTab, NodeTabType};
|
||||
use crate::node::{Node, NodeConfig};
|
||||
use crate::wallet::WalletConfig;
|
||||
|
||||
/// Mining tab content.
|
||||
pub struct NetworkMining {
|
||||
/// Stratum server setup content.
|
||||
stratum_server_setup: StratumSetup,
|
||||
|
||||
/// Wallet name for rewards.
|
||||
wallet_name: String,
|
||||
}
|
||||
|
||||
impl Default for NetworkMining {
|
||||
fn default() -> Self {
|
||||
let wallet_name = if let Some(id) = NodeConfig::get_stratum_wallet_id() {
|
||||
WalletConfig::name_by_id(id).unwrap_or("-".to_string())
|
||||
} else {
|
||||
"-".to_string()
|
||||
};
|
||||
Self {
|
||||
stratum_server_setup: StratumSetup::default(),
|
||||
wallet_name,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,7 +81,10 @@ impl NodeTab for NetworkMining {
|
||||
});
|
||||
columns[1].vertical_centered(|ui| {
|
||||
View::label_box(ui,
|
||||
self.wallet_name.clone(),
|
||||
self.stratum_server_setup
|
||||
.wallet_name
|
||||
.clone()
|
||||
.unwrap_or("-".to_string()),
|
||||
t!("network_mining.rewards_wallet"),
|
||||
[false, true, false, true]);
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@ pub struct StratumSetup {
|
||||
is_port_available: bool,
|
||||
|
||||
/// Wallet name to receive rewards.
|
||||
wallet_name: Option<String>,
|
||||
pub wallet_name: Option<String>,
|
||||
|
||||
/// Attempt time value in seconds to mine on a particular header.
|
||||
attempt_time_edit: String,
|
||||
|
||||
Reference in New Issue
Block a user