From aea14f6bf302801c85efa9f304a8f442aaf9a3ff Mon Sep 17 00:00:00 2001 From: Hansie Odendaal <39146854+hansieodendaal@users.noreply.github.com> Date: Thu, 20 Apr 2023 09:02:40 +0200 Subject: [PATCH] feat: add miner timeout config option (#5331) Description --- Added miner timeout configuration option. Motivation and Context --- The hard-coded default of 10s was not flexible enough. How Has This Been Tested? --- System-level testing What process can a PR reviewer use to test or verify this change? --- Run a miner with different config options for `wait_timeout_on_error` and observe the log file for messages of type `[tari::miner::main] INFO Holding for XX` Breaking Changes --- - [x] None - [ ] Requires data directory on base node to be deleted - [ ] Requires hard fork - [ ] Other - Please specify --- applications/tari_miner/src/config.rs | 6 ++++-- common/config/presets/g_miner.toml | 3 +++ common/config/presets/j_dan_wallet_daemon.toml | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/applications/tari_miner/src/config.rs b/applications/tari_miner/src/config.rs index 2407129153..55554bfa44 100644 --- a/applications/tari_miner/src/config.rs +++ b/applications/tari_miner/src/config.rs @@ -75,6 +75,8 @@ pub struct MinerConfig { pub coinbase_extra: String, /// Selected network pub network: Network, + /// Base node reconnect timeout after any GRPC or miner error + pub wait_timeout_on_error: u64, } #[derive(Serialize, Deserialize, Debug, Default)] @@ -104,6 +106,7 @@ impl Default for MinerConfig { mining_worker_name: String::new(), coinbase_extra: "tari_miner".to_string(), network: Default::default(), + wait_timeout_on_error: 10, } } } @@ -119,8 +122,7 @@ impl MinerConfig { } pub fn wait_timeout(&self) -> Duration { - // TODO: add config parameter - Duration::from_secs(10) + Duration::from_secs(self.wait_timeout_on_error) } pub fn validate_tip_interval(&self) -> Duration { diff --git a/common/config/presets/g_miner.toml b/common/config/presets/g_miner.toml index 31e649f54e..717a9da1d7 100644 --- a/common/config/presets/g_miner.toml +++ b/common/config/presets/g_miner.toml @@ -34,3 +34,6 @@ # Stratum Mode configuration - mining worker name (e.g. "worker1") # mining_worker_name = "worker1" + +# Base node reconnect timeout after any GRPC or miner error (default: 10 s) +# wait_timeout_on_error = 10 diff --git a/common/config/presets/j_dan_wallet_daemon.toml b/common/config/presets/j_dan_wallet_daemon.toml index 70b19d61a5..66c1d8aefc 100644 --- a/common/config/presets/j_dan_wallet_daemon.toml +++ b/common/config/presets/j_dan_wallet_daemon.toml @@ -1,3 +1,10 @@ + +######################################################################################################################## +# # +# DAN Wallet Daemon Configuration Options () # +# # +######################################################################################################################## + [dan_wallet_daemon] # JSON-RPC listener address (default = "127.0.0.1:9000") # listen_addr = "127.0.0.1:9000"