Skip to content

Commit

Permalink
refactor: stratum transcoder config cleanup (#3158)
Browse files Browse the repository at this point in the history
<!--- Provide a general summary of your changes in the Title above -->

## Description
Moved stratum_transcoder config variables to its' own section.
Fixed bug in defaults for stratum_transcoder.
Updated example config and cucumber variable to reflect changes in configuration.
Added stratum mode configuration variables for tari_mining_node in sample config, commented out by default.

## Motivation and Context
Cleanup and bugfix

## How Has This Been Tested?
Manual testing

## Checklist:
* [x] I'm merging against the `development` branch.
* [x] I have squashed my commits into a single commit.
  • Loading branch information
aviator-app[bot] authored Aug 4, 2021
2 parents 29ba9c4 + 1564e5f commit ee13b53
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
10 changes: 9 additions & 1 deletion common/config/presets/tari_config_example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,6 @@ monerod_url = "http://monero-stagenet.exan.tech:38081" # stagenet

# Address of the tari_merge_mining_proxy application
proxy_host_address = "127.0.0.1:7878"
transcoder_host_address = "127.0.0.1:7879"

# In sole merged mining, the block solution is usually submitted to the Monero blockchain
# (monerod) as well as to the Tari blockchain, then this setting should be "true". With pool
Expand All @@ -492,6 +491,11 @@ monerod_password = ""
# accepted. (Default value = true; will wait for base node initial sync).
#wait_for_initial_sync_at_startup = true

[stratum_transcoder]

# Address of the tari_stratum_transcoder application
transcoder_host_address = "127.0.0.1:7879"

[mining_node]
# Number of mining threads
# Default: number of logical CPU cores
Expand All @@ -515,3 +519,7 @@ monerod_password = ""
# to true
# Default: 30 seconds
#validate_tip_timeout_sec=30

# Stratum Mode configuration
# mining_pool_address = "miningcore.tarilabs.com:3052"
# mining_wallet_address = "YOUR_WALLET_PUBLIC_KEY"
2 changes: 1 addition & 1 deletion common/src/configuration/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ fn convert_node_config(
.map_err(|e| ConfigurationError::new(&key, &e.to_string()))
})?;

let key = config_string("merge_mining_proxy", &net_str, "transcoder_host_address");
let key = config_string("stratum_transcoder", &net_str, "transcoder_host_address");
let transcoder_host_address = cfg
.get_str(&key)
.map_err(|e| ConfigurationError::new(&key, &e.to_string()))
Expand Down
16 changes: 11 additions & 5 deletions common/src/configuration/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,21 @@ pub fn default_config(bootstrap: &ConfigBootstrap) -> Config {
set_transport_defaults(&mut cfg).unwrap();
set_merge_mining_defaults(&mut cfg);
set_mining_node_defaults(&mut cfg);
set_stratum_transcoder_defaults(&mut cfg);

cfg
}

fn set_stratum_transcoder_defaults(cfg: &mut Config) {
cfg.set_default("stratum_transcoder.mainnet.transcoder_host_address", "127.0.0.1:7879")
.unwrap();
cfg.set_default(
"stratum_transcoder.weatherwax.transcoder_host_address",
"127.0.0.1:7879",
)
.unwrap();
}

fn set_merge_mining_defaults(cfg: &mut Config) {
cfg.set_default(
"merge_mining_proxy.mainnet.monerod_url",
Expand All @@ -254,8 +265,6 @@ fn set_merge_mining_defaults(cfg: &mut Config) {
.unwrap();
cfg.set_default("merge_mining_proxy.mainnet.proxy_host_address", "127.0.0.1:7878")
.unwrap();
cfg.set_default("merge_mining_proxy.mainnet.transcoder_host_address", "127.0.0.1:7879")
.unwrap();
cfg.set_default("merge_mining_proxy.mainnet.monerod_use_auth", "false")
.unwrap();
cfg.set_default("merge_mining_proxy.mainnet.monerod_username", "")
Expand All @@ -264,16 +273,13 @@ fn set_merge_mining_defaults(cfg: &mut Config) {
.unwrap();
cfg.set_default("merge_mining_proxy.mainnet.wait_for_initial_sync_at_startup", true)
.unwrap();

cfg.set_default(
"merge_mining_proxy.weatherwax.monerod_url",
"http://monero-stagenet.exan.tech:38081",
)
.unwrap();
cfg.set_default("merge_mining_proxy.weatherwax.proxy_host_address", "127.0.0.1:7878")
.unwrap();
cfg.set_default("merge_mining_proxy.mainnet.transcoder_host_address", "127.0.0.1:7879")
.unwrap();
cfg.set_default("merge_mining_proxy.weatherwax.proxy_submit_to_origin", true)
.unwrap();
cfg.set_default("merge_mining_proxy.weatherwax.monerod_use_auth", "false")
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/helpers/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function createEnv(
`TARI_MERGE_MINING_PROXY__${network}__PROXY_HOST_ADDRESS`
] = `${proxyFullAddress}`;
configEnvs[
`TARI_MERGE_MINING_PROXY__${network}__TRANSCODER_HOST_ADDRESS`
`TARI_STRATUM_TRANSCODER__${network}__TRANSCODER_HOST_ADDRESS`
] = `${transcoderFullAddress}`;
configEnvs[`TARI_BASE_NODE__${network}__TRANSPORT`] = "tcp";
configEnvs[`TARI_WALLET__${network}__TRANSPORT`] = "tcp";
Expand Down

0 comments on commit ee13b53

Please sign in to comment.