@@ -1656,52 +1656,220 @@ impl BurnchainConfigFile {
1656
1656
1657
1657
#[ derive( Clone , Debug ) ]
1658
1658
pub struct NodeConfig {
1659
+ /// Human-readable name for the node. Primarily used for identification in testing environments
1660
+ /// (e.g., deriving log file names, temporary directory names).
1661
+ ///
1662
+ /// Default: `"helium-node"`
1659
1663
pub name : String ,
1664
+ /// The node's Bitcoin wallet private key, provided as a hex string in the config file.
1665
+ /// Used to initialize the node's keychain for signing operations.
1666
+ /// If `miner.mining_key` is not set, this seed may also be used for mining-related signing.
1667
+ /// Required if the node is configured as a miner (`node.miner = true`) and `miner.mining_key` is absent.
1668
+ ///
1669
+ /// Default: Randomly generated 32 bytes.
1660
1670
pub seed : Vec < u8 > ,
1671
+ /// The file system absolute path to the node's working directory.
1672
+ /// All persistent data, including chainstate, burnchain databases, and potentially other stores,
1673
+ /// will be located within this directory.
1674
+ /// This path can be overridden by setting the `STACKS_WORKING_DIR` environment variable.
1675
+ ///
1676
+ /// Default: `/tmp/stacks-node-{current_timestamp}`.
1661
1677
pub working_dir : String ,
1678
+ /// The IPv4 address and port (e.g., "0.0.0.0:20443") on which the node's HTTP RPC server
1679
+ /// should bind and listen for incoming API requests.
1680
+ ///
1681
+ /// Default: `"0.0.0.0:20443"`
1662
1682
pub rpc_bind : String ,
1683
+ /// The IPv4 address and port (e.g., "0.0.0.0:20444") on which the node's P2P networking
1684
+ /// service should bind and listen for incoming connections from other peers.
1685
+ ///
1686
+ /// Default: `"0.0.0.0:20444"`
1663
1687
pub p2p_bind : String ,
1688
+ /// The publicly accessible URL that this node advertises to peers during the P2P handshake
1689
+ /// as its HTTP RPC endpoint. Other nodes or services might use this URL to query the node's API.
1690
+ ///
1691
+ /// Default: `http://{rpc_bind}` (e.g., "http://127.0.0.1:20443" if rpc_bind is default and resolves locally).
1664
1692
pub data_url : String ,
1693
+ /// The publicly accessible IPv4 address and port that this node advertises to peers for P2P connections.
1694
+ /// This might differ from `p2p_bind` if the node is behind NAT or a proxy.
1695
+ /// Note: The default value derivation might be unexpected, potentially using the `rpc_bind` address; explicit configuration is recommended if needed.
1696
+ ///
1697
+ /// Default: Derived from `rpc_bind` (e.g., "127.0.0.1:20443" with default settings).
1665
1698
pub p2p_address : String ,
1699
+ /// The private key seed, provided as a hex string in the config file, used specifically for the
1700
+ /// node's identity and message signing within the P2P networking layer.
1701
+ /// This is separate from the main `node.seed`.
1702
+ ///
1703
+ /// Default: Randomly generated 32 bytes.
1666
1704
pub local_peer_seed : Vec < u8 > ,
1705
+ /// A list of initial peer nodes used to bootstrap connections into the Stacks P2P network.
1706
+ /// Peers are specified as comma-separated strings in the format "PUBKEY@IP:PORT" or "PUBKEY@HOSTNAME:PORT"
1707
+ /// in the configuration file. DNS hostnames are resolved during configuration loading.
1708
+ /// If empty on mainnet, default Hiro and Stacks seed nodes are used.
1709
+ ///
1710
+ /// Default: Empty vector `[]`.
1667
1711
pub bootstrap_node : Vec < Neighbor > ,
1712
+ /// A list of peer addresses that this node should explicitly deny connections from.
1713
+ /// Peers are specified as comma-separated strings in the format "IP:PORT" or "HOSTNAME:PORT"
1714
+ /// in the configuration file. DNS hostnames are resolved during configuration loading.
1715
+ ///
1716
+ /// Default: Empty vector `[]`.
1668
1717
pub deny_nodes : Vec < Neighbor > ,
1718
+ /// Flag indicating whether this node should activate its mining logic and attempt to produce Stacks blocks.
1719
+ /// Setting this to `true` typically requires providing necessary private keys (either `node.seed` or `miner.mining_key`).
1720
+ /// It also influences default behavior for settings like `require_affirmed_anchor_blocks`.
1721
+ ///
1722
+ /// Default: `false`
1669
1723
pub miner : bool ,
1724
+ /// Flag indicating whether this node is configured to operate with Stacker responsibilities,
1725
+ /// such as participating in (PoX) by signaling support via StackerDB interactions.
1726
+ /// Setting this to `true` requires also running a signer.
1727
+ ///
1728
+ /// Default: `false`
1670
1729
pub stacker : bool ,
1730
+ /// Enables a simulated mining mode, primarily for local testing and development.
1731
+ /// When `true`, the node may generate blocks locally without participating in the real
1732
+ /// burn chain consensus or P2P block production process.
1733
+ ///
1734
+ /// Default: `false`
1671
1735
pub mock_mining : bool ,
1672
- /// Where to output blocks from mock mining
1736
+ /// If `mock_mining` is enabled, this specifies an optional directory path where the
1737
+ /// generated mock Stacks blocks will be saved. (pre-Nakamoto)
1738
+ /// The path is canonicalized on load.
1739
+ ///
1740
+ /// Default: `None`
1741
+ /// Deprecated: This setting was only used in the neon node and is ignored in Epoch 3.0+.
1673
1742
pub mock_mining_output_dir : Option < PathBuf > ,
1743
+ /// Enable microblock mining.
1744
+ ///
1745
+ /// Default: `true`
1746
+ /// Deprecated: Microblocks were removed in the Nakamoto upgrade. This setting is ignored in Epoch 3.0+.
1674
1747
pub mine_microblocks : bool ,
1748
+ /// How often to attempt producing microblocks, in milliseconds (pre-Nakamoto).
1749
+ /// Only applies when `mine_microblocks` is true and before Epoch 3.0.
1750
+ ///
1751
+ /// Default: `30_000`
1752
+ /// Deprecated: Microblocks were removed in the Nakamoto upgrade. This setting is ignored in Epoch 3.0+.
1675
1753
pub microblock_frequency : u64 ,
1754
+ /// The maximum number of microblocks allowed per Stacks block (pre-Nakamoto).
1755
+ ///
1756
+ /// Default: `65535` (u16::MAX)
1757
+ /// Deprecated: Microblocks were removed in the Nakamoto upgrade. This setting is ignored in Epoch 3.0+.
1676
1758
pub max_microblocks : u64 ,
1759
+ /// Cooldown period after a microblock is produced, in milliseconds (pre-Nakamoto).
1760
+ /// Only applies when `mine_microblocks` is true and before Epoch 3.0.
1761
+ ///
1762
+ /// Default: `30_000`
1763
+ /// Deprecated: Microblocks were removed in the Nakamoto upgrade. This setting is ignored in Epoch 3.0+.
1677
1764
pub wait_time_for_microblocks : u64 ,
1765
+ /// Maximum time (in milliseconds) to wait between mining blocks.
1766
+ ///
1767
+ /// Default: `30_000`
1678
1768
pub wait_time_for_blocks : u64 ,
1679
- /// Controls how frequently, in milliseconds, the nakamoto miner's relay thread acts on its own initiative
1680
- /// (as opposed to responding to an event from the networking thread, etc.). This is roughly
1681
- /// how frequently the miner checks if a new burnchain block has been processed.
1769
+ /// Controls how frequently, in milliseconds, the Nakamoto miner's relay thread polls for work
1770
+ /// or takes periodic actions when idle (e.g., checking for new burnchain blocks).
1771
+ /// Default value of 10 seconds is reasonable in mainnet (where bitcoin blocks are ~10 minutes)
1772
+ /// A lower value might be useful in other environments with faster burn blocks.
1682
1773
///
1683
- /// Default value of 10 seconds is reasonable in mainnet (where bitcoin blocks are ~10 minutes),
1684
- /// but environments where burn blocks are more frequent may want to decrease this value.
1774
+ /// Default: `10_000` (10 seconds)
1685
1775
pub next_initiative_delay : u64 ,
1776
+ /// Optional network address and port (e.g., "127.0.0.1:9153") for binding the Prometheus metrics server.
1777
+ /// If set, the node will start an HTTP server on this address to expose internal metrics
1778
+ /// for scraping by a Prometheus instance.
1779
+ ///
1780
+ /// Default: `None` (Prometheus server disabled).
1686
1781
pub prometheus_bind : Option < String > ,
1782
+ /// The strategy to use for MARF trie node caching in memory.
1783
+ /// Controls the trade-off between memory usage and performance for state access.
1784
+ ///
1785
+ /// Possible values:
1786
+ /// - `"noop"`: No caching (least memory).
1787
+ /// - `"everything"`: Cache all nodes (most memory, potentially fastest).
1788
+ /// - `"node256"`: Cache only larger `TrieNode256` nodes.
1789
+ ///
1790
+ /// If the value is `None` or an unrecognized string, it defaults to `"noop"`.
1791
+ ///
1792
+ /// Default: `None` (effectively `"noop"`).
1687
1793
pub marf_cache_strategy : Option < String > ,
1794
+ /// Controls the timing of hash calculations for MARF trie nodes.
1795
+ /// If `true`, hashes are calculated only when the MARF is flushed to disk (deferred hashing).
1796
+ /// If `false`, hashes are calculated immediately as leaf nodes are inserted or updated (immediate hashing).
1797
+ /// Deferred hashing might improve write performance.
1798
+ ///
1799
+ /// Default: `true`
1688
1800
pub marf_defer_hashing : bool ,
1801
+ /// Sampling interval in seconds for the PoX synchronization watchdog thread (pre-Nakamoto).
1802
+ /// Determines how often the watchdog checked PoX state consistency in the Neon run loop.
1803
+ ///
1804
+ /// Default: `30`
1805
+ /// Deprecated: Unused after the Nakamoto upgrade. This setting is ignored in Epoch 3.0+.
1689
1806
pub pox_sync_sample_secs : u64 ,
1807
+ /// If set to `true`, the node initializes its state using an alternative test genesis block definition,
1808
+ /// loading different initial balances, names, and lockups than the standard network genesis.
1809
+ /// This is intended strictly for testing purposes and is disallowed on mainnet.
1810
+ ///
1811
+ /// Default: `None` (uses standard network genesis).
1690
1812
pub use_test_genesis_chainstate : Option < bool > ,
1813
+ /// Controls if Stacks Epoch 2.1+ affirmation map logic should be applied even before Epoch 2.1.
1814
+ /// If `true` (default), the node consistently uses the newer (Epoch 2.1) rules for PoX anchor block
1815
+ /// validation and affirmation-based reorg handling, even in earlier epochs.
1816
+ /// If `false`, the node strictly follows the rules defined for the specific epoch it is currently
1817
+ /// processing, only applying 2.1+ logic from Epoch 2.1 onwards.
1818
+ /// Differences in this setting between nodes prior to Epoch 2.1 could lead to consensus forks.
1819
+ ///
1820
+ /// Default: `true`
1691
1821
pub always_use_affirmation_maps : bool ,
1822
+ /// Controls if the node must wait for locally missing but burnchain-affirmed PoX anchor blocks.
1823
+ /// If an anchor block is confirmed by the affirmation map but not yet processed by this node:
1824
+ /// - If `true`: Burnchain processing halts until the affirmed block is acquired. Ensures strict
1825
+ /// adherence to the affirmed canonical chain, typical for followers.
1826
+ /// - If `false`: Burnchain processing continues without waiting. Allows miners to operate optimistically
1827
+ /// but may necessitate unwinding later if the affirmed block alters the chain state.
1828
+ ///
1829
+ /// Default: default is `true` for followers and `false` for miners (when not explicitly configured).
1692
1830
pub require_affirmed_anchor_blocks : bool ,
1831
+ /// Controls if the node must strictly wait for any PoX anchor block selected by the core consensus mechanism.
1832
+ /// - If `true`: Halts burnchain processing immediately whenever a selected anchor block is missing locally
1833
+ /// (`SelectedAndUnknown` status), regardless of affirmation status. This is always true in Nakamoto (Epoch 3.0+)
1834
+ /// and runs *before* affirmation checks.
1835
+ /// - If `false` (primarily for testing): Skips this immediate halt, allowing processing to proceed to
1836
+ /// affirmation map checks.
1837
+ /// Normal operation requires this to be `true`; setting to `false` will likely break consensus adherence.
1838
+ /// This parameter cannot be set via the configuration file; it must be modified programmatically.
1839
+
1840
+ /// Default: `true`
1693
1841
pub assume_present_anchor_blocks : bool ,
1694
- /// Fault injection for failing to push blocks
1842
+ /// Fault injection setting for testing purposes. If set to `Some(p)`, where `p` is between 0 and 100,
1843
+ /// the node will have a `p` percent chance of intentionally *not* pushing a newly processed block
1844
+ /// to its peers.
1845
+ ///
1846
+ /// Default: `None` (no fault injection).
1695
1847
pub fault_injection_block_push_fail_probability : Option < u8 > ,
1696
- // fault injection for hiding blocks.
1697
- // not part of the config file.
1848
+ /// Fault injection setting for testing purposes. If `true`, the node's chainstate database
1849
+ /// access layer may intentionally fail to retrieve block data, even if it exists,
1850
+ /// simulating block hiding or data unavailability.
1851
+ /// This parameter cannot be set via the configuration file; it must be modified programmatically.
1852
+ ///
1853
+ /// Default: `false`
1698
1854
pub fault_injection_hide_blocks : bool ,
1699
- /// At most, how often should the chain-liveness thread
1700
- /// wake up the chains-coordinator. Defaults to 300s (5 min).
1855
+ /// The polling interval, in seconds, for the background thread that monitors chain liveness.
1856
+ /// This thread periodically wakes up the main coordinator to check for chain progress or
1857
+ /// other conditions requiring action.
1858
+ ///
1859
+ /// Default: `300` (5 minutes)
1701
1860
pub chain_liveness_poll_time_secs : u64 ,
1702
- /// stacker DBs we replicate
1861
+ /// A list of specific StackerDB contracts (identified by their qualified contract identifiers,
1862
+ /// e.g., "SP000000000000000000002Q6VF78.pox-3") that this node should actively replicate.
1863
+ /// If the node is configured as a miner (`node.miner = true`) or stacker (`node.stacker = true`),
1864
+ /// relevant system contracts (like `.miners` and `.signers-*`) are typically added automatically.
1865
+ ///
1866
+ /// Default: Empty vector `[]`.
1703
1867
pub stacker_dbs : Vec < QualifiedContractIdentifier > ,
1704
- /// enable transactions indexing
1868
+ /// Enables the transaction index, which maps transaction IDs to the blocks containing them.
1869
+ /// Setting this to `true` allows the use of RPC endpoints that look up transactions by ID
1870
+ /// (e.g., `/extended/v1/tx/{txid}`), but requires substantial additional disk space for the index database.
1871
+ ///
1872
+ /// Default: `false`
1705
1873
pub txindex : bool ,
1706
1874
}
1707
1875
@@ -2119,14 +2287,25 @@ impl NodeConfig {
2119
2287
2120
2288
#[ derive( Clone , Debug , PartialEq ) ]
2121
2289
pub struct MinerConfig {
2290
+ /// Time to wait (in milliseconds) before the first attempt to mine a block.
2122
2291
pub first_attempt_time_ms : u64 ,
2292
+ /// Time to wait (in milliseconds) for subsequent attempts to mine a block,
2293
+ /// after the first attempt fails.
2123
2294
pub subsequent_attempt_time_ms : u64 ,
2295
+ /// Time to wait (in milliseconds) to mine a microblock,
2296
+ /// In epochs >= 3.0, this field is ignored.
2124
2297
pub microblock_attempt_time_ms : u64 ,
2125
2298
/// Max time to assemble Nakamoto block
2126
2299
pub nakamoto_attempt_time_ms : u64 ,
2127
2300
/// Strategy to follow when picking next mempool transactions to consider.
2128
2301
pub mempool_walk_strategy : MemPoolWalkStrategy ,
2302
+ /// Probability percentage to consider a transaction which has not received a cost estimate.
2303
+ /// Only used when walk strategy is `GlobalFeeRate`.
2129
2304
pub probability_pick_no_estimate_tx : u8 ,
2305
+ /// Optional recipient of the coinbase block reward.
2306
+ /// If set and the current Stacks epoch is ≥ 2.1, the block reward will be
2307
+ /// sent to this principal address instead of the default miner address.
2308
+ /// In epochs prior to 2.1, this field is ignored.
2130
2309
pub block_reward_recipient : Option < PrincipalData > ,
2131
2310
/// If possible, mine with a p2wpkh address
2132
2311
pub segwit : bool ,
0 commit comments