@@ -86,6 +86,7 @@ pub const OP_TX_ANY_ESTIM_SIZE: u64 = fmax!(
86
86
const DEFAULT_MAX_RBF_RATE : u64 = 150 ; // 1.5x
87
87
const DEFAULT_RBF_FEE_RATE_INCREMENT : u64 = 5 ;
88
88
const INV_REWARD_CYCLES_TESTNET : u64 = 6 ;
89
+ const DEFAULT_MINIMUM_GAP_SECS : u64 = 1 ;
89
90
90
91
#[ derive( Clone , Deserialize , Default , Debug ) ]
91
92
pub struct ConfigFile {
@@ -2358,6 +2359,9 @@ pub struct MinerConfig {
2358
2359
pub wait_on_signers : Duration ,
2359
2360
/// Whether to mock sign in Epoch 2.5 through the .miners and .signers contracts. This is used for testing purposes in Epoch 2.5 only.
2360
2361
pub pre_nakamoto_mock_signing : bool ,
2362
+ /// The minimum gap to wait between blocks in seconds. The value must be greater than or equal to 1 second because if a block is mined
2363
+ /// within the same second as its parent, it will be rejected by the signers.
2364
+ pub min_block_time_gap_secs : u64 ,
2361
2365
}
2362
2366
2363
2367
impl Default for MinerConfig {
@@ -2389,6 +2393,7 @@ impl Default for MinerConfig {
2389
2393
// TODO: update to a sane value based on stackerdb benchmarking
2390
2394
wait_on_signers : Duration :: from_secs ( 200 ) ,
2391
2395
pre_nakamoto_mock_signing : false , // Should only default true if mining key is set
2396
+ min_block_time_gap_secs : DEFAULT_MINIMUM_GAP_SECS ,
2392
2397
}
2393
2398
}
2394
2399
}
@@ -2739,6 +2744,7 @@ pub struct MinerConfigFile {
2739
2744
pub max_reorg_depth : Option < u64 > ,
2740
2745
pub wait_on_signers_ms : Option < u64 > ,
2741
2746
pub pre_nakamoto_mock_signing : Option < bool > ,
2747
+ pub min_block_time_gap_secs : Option < u64 > ,
2742
2748
}
2743
2749
2744
2750
impl MinerConfigFile {
@@ -2850,6 +2856,12 @@ impl MinerConfigFile {
2850
2856
pre_nakamoto_mock_signing : self
2851
2857
. pre_nakamoto_mock_signing
2852
2858
. unwrap_or ( pre_nakamoto_mock_signing) , // Should only default true if mining key is set
2859
+ min_block_time_gap_secs : self . min_block_time_gap_secs . map ( |secs| if secs < DEFAULT_MINIMUM_GAP_SECS {
2860
+ warn ! ( "miner.min_block_time_gap_secs is less than the minimum allowed value of {DEFAULT_MINIMUM_GAP_SECS} secs. Using the default value instead." ) ;
2861
+ DEFAULT_MINIMUM_GAP_SECS
2862
+ } else {
2863
+ secs
2864
+ } ) . unwrap_or ( miner_default_config. min_block_time_gap_secs ) ,
2853
2865
} )
2854
2866
}
2855
2867
}
0 commit comments