Skip to content

Commit b57b7e0

Browse files
authored
Merge pull request #5372 from stacks-network/fix/miner-forking
Fix/miner forking: increase the reward cycle length to increase liklihood of the test case hitting before reward cycle end
2 parents 4bf673f + 03831e0 commit b57b7e0

File tree

1 file changed

+7
-6
lines changed
  • testnet/stacks-node/src/tests/signer

1 file changed

+7
-6
lines changed

testnet/stacks-node/src/tests/signer/v0.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,6 +1746,8 @@ fn miner_forking() {
17461746
let node_2_rpc_bind = format!("{localhost}:{node_2_rpc}");
17471747
let mut node_2_listeners = Vec::new();
17481748

1749+
let max_sortitions = 30;
1750+
17491751
// partition the signer set so that ~half are listening and using node 1 for RPC and events,
17501752
// and the rest are using node 2
17511753

@@ -1776,6 +1778,7 @@ fn miner_forking() {
17761778
config.burnchain.local_mining_public_key = Some(btc_miner_1_pk.to_hex());
17771779
config.miner.mining_key = Some(Secp256k1PrivateKey::from_seed(&[1]));
17781780
config.node.pox_sync_sample_secs = 30;
1781+
config.burnchain.pox_reward_length = Some(max_sortitions as u32);
17791782

17801783
config.events_observers.retain(|listener| {
17811784
let Ok(addr) = std::net::SocketAddr::from_str(&listener.endpoint) else {
@@ -1797,11 +1800,10 @@ fn miner_forking() {
17971800
);
17981801
let conf = signer_test.running_nodes.conf.clone();
17991802
let mut conf_node_2 = conf.clone();
1800-
let localhost = "127.0.0.1";
1801-
conf_node_2.node.rpc_bind = format!("{}:{}", localhost, node_2_rpc);
1802-
conf_node_2.node.p2p_bind = format!("{}:{}", localhost, node_2_p2p);
1803-
conf_node_2.node.data_url = format!("http://{}:{}", localhost, node_2_rpc);
1804-
conf_node_2.node.p2p_address = format!("{}:{}", localhost, node_2_p2p);
1803+
conf_node_2.node.rpc_bind = node_2_rpc_bind;
1804+
conf_node_2.node.p2p_bind = format!("{localhost}:{node_2_p2p}");
1805+
conf_node_2.node.data_url = format!("http://{localhost}:{node_2_rpc}");
1806+
conf_node_2.node.p2p_address = format!("{localhost}:{node_2_p2p}");
18051807
conf_node_2.node.seed = btc_miner_2_seed.clone();
18061808
conf_node_2.burnchain.local_mining_public_key = Some(btc_miner_2_pk.to_hex());
18071809
conf_node_2.node.local_peer_seed = btc_miner_2_seed.clone();
@@ -1931,7 +1933,6 @@ fn miner_forking() {
19311933
// (a) its the first nakamoto tenure
19321934
// (b) the prior sortition didn't have a tenure (because by this time RL2 will have up-to-date block processing)
19331935
let mut expects_miner_2_to_be_valid = true;
1934-
let max_sortitions = 20;
19351936
// due to the random nature of mining sortitions, the way this test is structured
19361937
// is that keeps track of two scenarios that we want to cover, and once enough sortitions
19371938
// have been produced to cover those scenarios, it stops and checks the results at the end.

0 commit comments

Comments
 (0)