@@ -1972,52 +1972,230 @@ impl BurnchainConfigFile {
1972
1972
1973
1973
#[ derive( Clone , Debug ) ]
1974
1974
pub struct NodeConfig {
1975
+ /// Human-readable name for the node. Primarily used for identification in testing environments
1976
+ /// (e.g., deriving log file names, temporary directory names).
1977
+ ///
1978
+ /// Default: `"helium-node"`
1975
1979
pub name : String ,
1980
+ /// The node's Bitcoin wallet private key, provided as a hex string in the config file.
1981
+ /// Used to initialize the node's keychain for signing operations.
1982
+ /// If `miner.mining_key` is not set, this seed may also be used for mining-related signing.
1983
+ /// Required if [`NodeConfig::miner`] is `true` and [`MinerConfig::mining_key`] is absent.
1984
+ ///
1985
+ /// Default: Randomly generated 32 bytes.
1976
1986
pub seed : Vec < u8 > ,
1987
+ /// The file system absolute path to the node's working directory.
1988
+ /// All persistent data, including chainstate, burnchain databases, and potentially other stores,
1989
+ /// will be located within this directory.
1990
+ /// This path can be overridden by setting the `STACKS_WORKING_DIR` environment variable.
1991
+ /// Note: For persistent mainnet or testnet nodes, this path must be explicitly
1992
+ /// configured to a non-temporary location in the configuration file.
1993
+ ///
1994
+ /// Default: `/tmp/stacks-node-{current_timestamp}`.
1977
1995
pub working_dir : String ,
1996
+ /// The IPv4 address and port (e.g., "0.0.0.0:20443") on which the node's HTTP RPC server
1997
+ /// should bind and listen for incoming API requests.
1998
+ ///
1999
+ /// Default: `"0.0.0.0:20443"`
1978
2000
pub rpc_bind : String ,
2001
+ /// The IPv4 address and port (e.g., "0.0.0.0:20444") on which the node's P2P networking
2002
+ /// service should bind and listen for incoming connections from other peers.
2003
+ ///
2004
+ /// Default: `"0.0.0.0:20444"`
1979
2005
pub p2p_bind : String ,
2006
+ /// The publicly accessible URL that this node advertises to peers during the P2P handshake
2007
+ /// as its HTTP RPC endpoint. Other nodes or services might use this URL to query the node's API.
2008
+ ///
2009
+ /// Default: `http://{rpc_bind}` (e.g., "http://0.0.0.0:20443" if rpc_bind is default).
1980
2010
pub data_url : String ,
2011
+ /// The publicly accessible IPv4 address and port that this node advertises to peers for P2P connections.
2012
+ /// This might differ from `p2p_bind` if the node is behind NAT or a proxy.
2013
+ /// Note: The default value derivation might be unexpected, potentially using the `rpc_bind` address; explicit configuration is recommended if needed.
2014
+ ///
2015
+ /// Default: Derived from `rpc_bind` (e.g., "0.0.0.0:20443" if rpc_bind is default).
1981
2016
pub p2p_address : String ,
2017
+ /// The private key seed, provided as a hex string in the config file, used specifically for the
2018
+ /// node's identity and message signing within the P2P networking layer.
2019
+ /// This is separate from the main [`NodeConfig::seed`].
2020
+ ///
2021
+ /// Default: Randomly generated 32 bytes.
1982
2022
pub local_peer_seed : Vec < u8 > ,
2023
+ /// A list of initial peer nodes used to bootstrap connections into the Stacks P2P network.
2024
+ /// Peers are specified in a configuration file as comma-separated strings in the
2025
+ /// format `"PUBKEY@IP:PORT"` or `"PUBKEY@HOSTNAME:PORT"`. DNS hostnames are resolved
2026
+ /// during configuration loading.
2027
+ ///
2028
+ /// Default: Empty vector `[]`.
1983
2029
pub bootstrap_node : Vec < Neighbor > ,
2030
+ /// A list of peer addresses that this node should explicitly deny connections from.
2031
+ /// Peers are specified as comma-separated strings in the format "IP:PORT" or "HOSTNAME:PORT"
2032
+ /// in the configuration file. DNS hostnames are resolved during configuration loading.
2033
+ ///
2034
+ /// Default: Empty vector `[]`.
1984
2035
pub deny_nodes : Vec < Neighbor > ,
2036
+ /// Flag indicating whether this node should activate its mining logic and attempt to produce Stacks blocks.
2037
+ /// Setting this to `true` typically requires providing necessary private keys (either [`NodeConfig::seed`] or [`MinerConfig::mining_key`]).
2038
+ /// It also influences default behavior for settings like [`NodeConfig::require_affirmed_anchor_blocks`].
2039
+ ///
2040
+ /// Default: `false`
1985
2041
pub miner : bool ,
2042
+ /// Setting this to `true` enables the node to replicate the miner and signer Stacker DBs
2043
+ /// required for signing, and is required if the node is connected to a signer.
2044
+ ///
2045
+ /// Default: `false`
1986
2046
pub stacker : bool ,
2047
+ /// Enables a simulated mining mode, primarily for local testing and development.
2048
+ /// When `true`, the node may generate blocks locally without participating in the
2049
+ /// real bitcoin consensus or P2P block production process.
2050
+ ///
2051
+ /// Only relevant if [`NodeConfig::miner`] is `true`.
2052
+ ///
2053
+ /// Default: `false`
1987
2054
pub mock_mining : bool ,
1988
- /// Where to output blocks from mock mining
2055
+ /// If [`NodeConfig::mock_mining`] is enabled, this specifies an optional directory path where the
2056
+ /// generated mock Stacks blocks will be saved. (pre-Nakamoto)
2057
+ /// The path is canonicalized on load.
2058
+ ///
2059
+ /// Default: `None`
2060
+ /// Deprecated: This setting was only used in the neon node and is ignored in Epoch 3.0+.
1989
2061
pub mock_mining_output_dir : Option < PathBuf > ,
2062
+ /// Enable microblock mining.
2063
+ ///
2064
+ /// Default: `true`
2065
+ /// Deprecated: This setting is ignored in Epoch 2.5+.
1990
2066
pub mine_microblocks : bool ,
2067
+ /// How often to attempt producing microblocks, in milliseconds.
2068
+ /// Only applies when [`NodeConfig::mine_microblocks`] is true and before Epoch 2.5.
2069
+ ///
2070
+ /// Default: `30_000` ms (30 seconds)
2071
+ /// Deprecated: This setting is ignored in Epoch 2.5+.
1991
2072
pub microblock_frequency : u64 ,
2073
+ /// The maximum number of microblocks allowed per Stacks block.
2074
+ ///
2075
+ /// Default: `65535` (u16::MAX)
2076
+ /// Deprecated: This setting is ignored in Epoch 2.5+.
1992
2077
pub max_microblocks : u64 ,
2078
+ /// Cooldown period after a microblock is produced, in milliseconds.
2079
+ /// Only applies when [`NodeConfig::mine_microblocks`] is true and before Epoch 2.5.
2080
+ ///
2081
+ /// Default: `30_000` ms (30 seconds)
2082
+ /// Deprecated: This setting is ignored in Epoch 2.5+.
1993
2083
pub wait_time_for_microblocks : u64 ,
2084
+ /// When operating as a miner, this specifies the maximum time (in milliseconds)
2085
+ /// the node waits after detecting a new burnchain block to synchronize corresponding
2086
+ /// Stacks block data from the network before resuming mining attempts.
2087
+ /// If synchronization doesn't complete within this duration, mining resumes anyway
2088
+ /// to prevent stalling. This setting is loaded by all nodes but primarily affects
2089
+ /// miner behavior within the relayer thread.
2090
+ ///
2091
+ /// Default: `30_000` ms (30 seconds)
1994
2092
pub wait_time_for_blocks : u64 ,
1995
- /// Controls how frequently, in milliseconds, the nakamoto miner's relay thread acts on its own initiative
1996
- /// (as opposed to responding to an event from the networking thread, etc.). This is roughly
1997
- /// how frequently the miner checks if a new burnchain block has been processed.
2093
+ /// Controls how frequently, in milliseconds, the Nakamoto miner's relay thread polls for work
2094
+ /// or takes periodic actions when idle (e.g., checking for new burnchain blocks).
2095
+ /// Default value of 10 seconds is reasonable in mainnet (where bitcoin blocks are ~10 minutes)
2096
+ /// A lower value might be useful in other environments with faster burn blocks.
1998
2097
///
1999
- /// Default value of 10 seconds is reasonable in mainnet (where bitcoin blocks are ~10 minutes),
2000
- /// but environments where burn blocks are more frequent may want to decrease this value.
2098
+ /// Default: `10_000` ms (10 seconds)
2001
2099
pub next_initiative_delay : u64 ,
2100
+ /// Optional network address and port (e.g., "127.0.0.1:9153") for binding the Prometheus metrics server.
2101
+ /// If set, the node will start an HTTP server on this address to expose internal metrics
2102
+ /// for scraping by a Prometheus instance.
2103
+ ///
2104
+ /// Default: `None` (Prometheus server disabled).
2002
2105
pub prometheus_bind : Option < String > ,
2106
+ /// The strategy to use for MARF trie node caching in memory.
2107
+ /// Controls the trade-off between memory usage and performance for state access.
2108
+ ///
2109
+ /// Possible values:
2110
+ /// - `"noop"`: No caching (least memory).
2111
+ /// - `"everything"`: Cache all nodes (most memory, potentially fastest).
2112
+ /// - `"node256"`: Cache only larger `TrieNode256` nodes.
2113
+ ///
2114
+ /// If the value is `None` or an unrecognized string, it defaults to `"noop"`.
2115
+ ///
2116
+ /// Default: `None` (effectively `"noop"`).
2003
2117
pub marf_cache_strategy : Option < String > ,
2118
+ /// Controls the timing of hash calculations for MARF trie nodes.
2119
+ /// - If `true`, hashes are calculated only when the MARF is flushed to disk (deferred hashing).
2120
+ /// - If `false`, hashes are calculated immediately as leaf nodes are inserted or updated (immediate hashing).
2121
+ /// Deferred hashing might improve write performance.
2122
+ ///
2123
+ /// Default: `true`
2004
2124
pub marf_defer_hashing : bool ,
2125
+ /// Sampling interval in seconds for the PoX synchronization watchdog thread (pre-Nakamoto).
2126
+ /// Determines how often the watchdog checked PoX state consistency in the Neon run loop.
2127
+ ///
2128
+ /// Default: `30` seconds
2129
+ /// Deprecated: Unused after the Nakamoto upgrade. This setting is ignored in Epoch 3.0+.
2005
2130
pub pox_sync_sample_secs : u64 ,
2131
+ /// If set to `true`, the node initializes its state using an alternative test genesis block definition,
2132
+ /// loading different initial balances, names, and lockups than the standard network genesis.
2133
+ /// This is intended strictly for testing purposes and is disallowed on mainnet.
2134
+ ///
2135
+ /// Default: `None` (uses standard network genesis).
2006
2136
pub use_test_genesis_chainstate : Option < bool > ,
2137
+ /// Controls if Stacks Epoch 2.1+ affirmation map logic should be applied even before Epoch 2.1.
2138
+ /// - If `true` (default), the node consistently uses the newer (Epoch 2.1) rules for PoX anchor block
2139
+ /// validation and affirmation-based reorg handling, even in earlier epochs.
2140
+ /// - If `false`, the node strictly follows the rules defined for the specific epoch it is currently
2141
+ /// processing, only applying 2.1+ logic from Epoch 2.1 onwards.
2142
+ /// Differences in this setting between nodes prior to Epoch 2.1 could lead to consensus forks.
2143
+ ///
2144
+ /// Default: `true`
2007
2145
pub always_use_affirmation_maps : bool ,
2146
+ /// Controls if the node must wait for locally missing but burnchain-affirmed PoX anchor blocks.
2147
+ /// If an anchor block is confirmed by the affirmation map but not yet processed by this node:
2148
+ /// - If `true`: Burnchain processing halts until the affirmed block is acquired. Ensures strict
2149
+ /// adherence to the affirmed canonical chain, typical for followers.
2150
+ /// - If `false`: Burnchain processing continues without waiting. Allows miners to operate optimistically
2151
+ /// but may necessitate unwinding later if the affirmed block alters the chain state.
2152
+ ///
2153
+ /// Default: `true` for followers, `false` for miners (when not explicitly configured).
2008
2154
pub require_affirmed_anchor_blocks : bool ,
2155
+ /// Controls if the node must strictly wait for any PoX anchor block selected by the core consensus mechanism.
2156
+ /// - If `true`: Halts burnchain processing immediately whenever a selected anchor block is missing locally
2157
+ /// (`SelectedAndUnknown` status), regardless of affirmation status. This is always true in Nakamoto (Epoch 3.0+)
2158
+ /// and runs *before* affirmation checks.
2159
+ /// - If `false` (primarily for testing): Skips this immediate halt, allowing processing to proceed to
2160
+ /// affirmation map checks.
2161
+ /// Normal operation requires this to be `true`; setting to `false` will likely break consensus adherence.
2162
+ /// This parameter cannot be set via the configuration file; it must be modified programmatically.
2163
+ ///
2164
+ /// Default: `true`
2009
2165
pub assume_present_anchor_blocks : bool ,
2010
- /// Fault injection for failing to push blocks
2166
+ /// Fault injection setting for testing purposes. If set to `Some(p)`, where `p` is between 0 and 100,
2167
+ /// the node will have a `p` percent chance of intentionally *not* pushing a newly processed block
2168
+ /// to its peers.
2169
+ ///
2170
+ /// Default: `None` (no fault injection).
2011
2171
pub fault_injection_block_push_fail_probability : Option < u8 > ,
2012
- // fault injection for hiding blocks.
2013
- // not part of the config file.
2172
+ /// Fault injection setting for testing purposes. If `true`, the node's chainstate database
2173
+ /// access layer may intentionally fail to retrieve block data, even if it exists,
2174
+ /// simulating block hiding or data unavailability.
2175
+ /// This parameter cannot be set via the configuration file; it must be modified programmatically.
2176
+ ///
2177
+ /// Default: `false`
2014
2178
pub fault_injection_hide_blocks : bool ,
2015
- /// At most, how often should the chain-liveness thread
2016
- /// wake up the chains-coordinator. Defaults to 300s (5 min).
2179
+ /// The polling interval, in seconds, for the background thread that monitors chain liveness.
2180
+ /// This thread periodically wakes up the main coordinator to check for chain progress or
2181
+ /// other conditions requiring action.
2182
+ ///
2183
+ /// Default: `300` seconds (5 minutes)
2017
2184
pub chain_liveness_poll_time_secs : u64 ,
2018
- /// stacker DBs we replicate
2185
+ /// A list of specific StackerDB contracts (identified by their qualified contract identifiers,
2186
+ /// e.g., "SP000000000000000000002Q6VF78.pox-3") that this node should actively replicate.
2187
+ ///
2188
+ /// Default: The initial list depends on the [`NodeConfig::miner`] and [`NodeConfig::stacker`] settings:
2189
+ /// - If `miner = true` or `stacker = true`: Relevant system contracts (like `.miners`
2190
+ /// and `.signers-*`) are automatically added during configuration loading, in addition
2191
+ /// to any contracts specified in the configuration file.
2192
+ /// - If `miner = false` and `stacker = false`: Empty vector `[]`.
2019
2193
pub stacker_dbs : Vec < QualifiedContractIdentifier > ,
2020
- /// enable transactions indexing
2194
+ /// Enables the transaction index, which maps transaction IDs to the blocks containing them.
2195
+ /// Setting this to `true` allows the use of RPC endpoints that look up transactions by ID
2196
+ /// (e.g., `/extended/v1/tx/{txid}`), but requires substantial additional disk space for the index database.
2197
+ ///
2198
+ /// Default: `false`
2021
2199
pub txindex : bool ,
2022
2200
}
2023
2201
0 commit comments