Skip to content

Commit

Permalink
feat: add miner timeout config option (#5331)
Browse files Browse the repository at this point in the history
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`

<!-- Checklist -->
<!-- 1. Is the title of your PR in the form that would make nice release
notes? The title, excluding the conventional commit
tag, will be included exactly as is in the CHANGELOG, so please think
about it carefully. -->


Breaking Changes
---

- [x] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [ ] Other - Please specify

<!-- Does this include a breaking change? If so, include this line as a
footer -->
<!-- BREAKING CHANGE: Description what the user should do, e.g. delete a
database, resync the chain -->
  • Loading branch information
hansieodendaal authored Apr 20, 2023
1 parent 7a80716 commit aea14f6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
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
7 changes: 7 additions & 0 deletions common/config/presets/j_dan_wallet_daemon.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit aea14f6

Please sign in to comment.