Skip to content

Commit

Permalink
Add miner timeout config option
Browse files Browse the repository at this point in the history
Added miner timeout configuration option. The hard-coded default of 10s was
not flexible enough.
  • Loading branch information
hansieodendaal committed Apr 17, 2023
1 parent 3dcb3ee commit fe68678
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion applications/tari_base_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ fn main_inner() -> Result<(), ExitError> {
consts::APP_VERSION
);

let mut config = ApplicationConfig::load_from(&cfg)?;
let config = ApplicationConfig::load_from(&cfg)?;
debug!(target: LOG_TARGET, "Using base node configuration: {:?}", config);

// Load or create the Node identity
Expand Down
6 changes: 4 additions & 2 deletions applications/tari_miner/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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,
}
}
}
Expand All @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions common/config/presets/g_miner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit fe68678

Please sign in to comment.