diff --git a/zebra-rpc/src/methods.rs b/zebra-rpc/src/methods.rs index ddcab2db9..1f39640e2 100644 --- a/zebra-rpc/src/methods.rs +++ b/zebra-rpc/src/methods.rs @@ -35,7 +35,7 @@ use zebra_state::{OutputIndex, OutputLocation, TransactionLocation}; use crate::queue::Queue; #[cfg(feature = "getblocktemplate-rpcs")] -mod get_block_template_rpcs; +pub mod get_block_template_rpcs; #[cfg(feature = "getblocktemplate-rpcs")] pub use get_block_template_rpcs::{GetBlockTemplateRpc, GetBlockTemplateRpcImpl}; diff --git a/zebra-rpc/src/methods/get_block_template_rpcs.rs b/zebra-rpc/src/methods/get_block_template_rpcs.rs index 05cf3f095..00e681242 100644 --- a/zebra-rpc/src/methods/get_block_template_rpcs.rs +++ b/zebra-rpc/src/methods/get_block_template_rpcs.rs @@ -15,6 +15,7 @@ use crate::methods::{ GetBlockHash, MISSING_BLOCK_ERROR_CODE, }; +pub mod config; pub(crate) mod types; /// getblocktemplate RPC method signatures. diff --git a/zebra-rpc/src/methods/get_block_template_rpcs/config.rs b/zebra-rpc/src/methods/get_block_template_rpcs/config.rs new file mode 100644 index 000000000..ae6e80915 --- /dev/null +++ b/zebra-rpc/src/methods/get_block_template_rpcs/config.rs @@ -0,0 +1,17 @@ +//! Mining config + +use serde::{Deserialize, Serialize}; + +use zebra_chain::transparent::Address; + +/// Mining configuration section. +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[serde(deny_unknown_fields, default)] +pub struct Config { + /// The address used for miner payouts. + /// Currently, Zebra only supports transparent addresses. + /// + /// Zebra sends mining fees and miner rewards to this address in the + /// `getblocktemplate` RPC coinbase transaction. + pub miner_address: Option
, +} diff --git a/zebrad/Cargo.toml b/zebrad/Cargo.toml index 9a6afe4ea..75126552e 100644 --- a/zebrad/Cargo.toml +++ b/zebrad/Cargo.toml @@ -15,6 +15,7 @@ default-run = "zebrad" [features] # In release builds, don't compile debug logging code, to improve performance. default = ["release_max_level_info"] +getblocktemplate-rpcs = ["zebra-rpc/getblocktemplate-rpcs"] # Production features that activate extra dependencies diff --git a/zebrad/src/config.rs b/zebrad/src/config.rs index 87a319926..ed1f19d1d 100644 --- a/zebrad/src/config.rs +++ b/zebrad/src/config.rs @@ -37,4 +37,8 @@ pub struct ZebradConfig { /// RPC configuration pub rpc: zebra_rpc::config::Config, + + #[cfg(feature = "getblocktemplate-rpcs")] + /// Mining configuration + pub mining: zebra_rpc::methods::get_block_template_rpcs::config::Config, } diff --git a/zebrad/tests/acceptance.rs b/zebrad/tests/acceptance.rs index 79f89fdd8..72873d63a 100644 --- a/zebrad/tests/acceptance.rs +++ b/zebrad/tests/acceptance.rs @@ -784,6 +784,18 @@ fn stored_configs_works() -> Result<()> { .expect("read_dir call failed") .flatten() { + // ignore files starting with getblocktemplate prefix + // if we were not built with the getblocktemplate-rpcs feature. + #[cfg(not(feature = "getblocktemplate-rpcs"))] + if config_file + .file_name() + .into_string() + .expect("all files names should be string convertible") + .starts_with("getblocktemplate-") + { + continue; + } + let run_dir = testdir()?; let stored_config_path = config_file_full_path(config_file.path()); diff --git a/zebrad/tests/common/configs/getblocktemplate-v1.0.0-rc.0.toml b/zebrad/tests/common/configs/getblocktemplate-v1.0.0-rc.0.toml new file mode 100644 index 000000000..b64dc7ed1 --- /dev/null +++ b/zebrad/tests/common/configs/getblocktemplate-v1.0.0-rc.0.toml @@ -0,0 +1,72 @@ +# Default configuration for zebrad. +# +# This file can be used as a skeleton for custom configs. +# +# Unspecified fields use default values. Optional fields are Some(field) if the +# field is present and None if it is absent. +# +# This file is generated as an example using zebrad's current defaults. +# You should set only the config options you want to keep, and delete the rest. +# Only a subset of fields are present in the skeleton, since optional values +# whose default is None are omitted. +# +# The config format (including a complete list of sections and fields) is +# documented here: +# https://doc.zebra.zfnd.org/zebrad/config/struct.ZebradConfig.html +# +# zebrad attempts to load configs in the following order: +# +# 1. The -c flag on the command line, e.g., `zebrad -c myconfig.toml start`; +# 2. The file `zebrad.toml` in the users's preference directory (platform-dependent); +# 3. The default config. + +[consensus] +checkpoint_sync = true +debug_skip_parameter_preload = false + +[mempool] +eviction_memory_time = '1h' +tx_cost_limit = 80000000 + +[metrics] + +[mining] + +[network] +crawl_new_peer_interval = '1m 1s' +initial_mainnet_peers = [ + 'dnsseed.z.cash:8233', + 'dnsseed.str4d.xyz:8233', + 'mainnet.seeder.zfnd.org:8233', + 'mainnet.is.yolo.money:8233', +] +initial_testnet_peers = [ + 'dnsseed.testnet.z.cash:18233', + 'testnet.seeder.zfnd.org:18233', + 'testnet.is.yolo.money:18233', +] +listen_addr = '0.0.0.0:8233' +network = 'Mainnet' +peerset_initial_target_size = 25 + +[rpc] +debug_force_finished_sync = false +parallel_cpu_threads = 1 + +[state] +cache_dir = 'cache_dir' +delete_old_database = true +ephemeral = false + +[sync] +checkpoint_verify_concurrency_limit = 800 +download_concurrency_limit = 50 +full_verify_concurrency_limit = 20 +parallel_cpu_threads = 0 + +[tracing] +buffer_limit = 128000 +force_use_color = false +use_color = true +use_journald = false +