Skip to content

Commit ea68752

Browse files
committed
test: remove unsused mutable from test utils to improve usabilty, #6104
1 parent 0ca28a0 commit ea68752

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

testnet/stacks-node/src/tests/nakamoto_integrations.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ pub fn naka_neon_integration_conf(seed: Option<&[u8]>) -> (Config, StacksAddress
659659
}
660660

661661
pub fn next_block_and<F>(
662-
btc_controller: &mut BitcoinRegtestController,
662+
btc_controller: &BitcoinRegtestController,
663663
timeout_secs: u64,
664664
mut check: F,
665665
) -> Result<(), String>
@@ -670,12 +670,12 @@ where
670670
}
671671

672672
pub fn next_block_and_controller<F>(
673-
btc_controller: &mut BitcoinRegtestController,
673+
btc_controller: &BitcoinRegtestController,
674674
timeout_secs: u64,
675675
mut check: F,
676676
) -> Result<(), String>
677677
where
678-
F: FnMut(&mut BitcoinRegtestController) -> Result<bool, String>,
678+
F: FnMut(&BitcoinRegtestController) -> Result<bool, String>,
679679
{
680680
eprintln!("Issuing bitcoin block");
681681
btc_controller.build_next_block(1);
@@ -708,7 +708,7 @@ where
708708
/// Mine a bitcoin block, and wait until:
709709
/// (1) a new block has been processed by the coordinator
710710
pub fn next_block_and_process_new_stacks_block(
711-
btc_controller: &mut BitcoinRegtestController,
711+
btc_controller: &BitcoinRegtestController,
712712
timeout_secs: u64,
713713
coord_channels: &Arc<Mutex<CoordinatorChannels>>,
714714
) -> Result<(), String> {
@@ -733,7 +733,7 @@ pub fn next_block_and_process_new_stacks_block(
733733
/// (2) 2 block commits have been issued ** or ** more than 10 seconds have
734734
/// passed since (1) occurred
735735
pub fn next_block_and_mine_commit(
736-
btc_controller: &mut BitcoinRegtestController,
736+
btc_controller: &BitcoinRegtestController,
737737
timeout_secs: u64,
738738
node_conf: &Config,
739739
node_counters: &Counters,
@@ -770,7 +770,7 @@ pub fn next_block_and_commits_only(
770770
/// passed since (1) occurred
771771
/// This waits for this check to pass on *all* supplied channels
772772
pub fn next_block_and_wait_for_commits(
773-
btc_controller: &mut BitcoinRegtestController,
773+
btc_controller: &BitcoinRegtestController,
774774
timeout_secs: u64,
775775
node_confs: &[&Config],
776776
node_counters: &[&Counters],

testnet/stacks-node/src/tests/neon_integrations.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -666,15 +666,15 @@ const PANIC_TIMEOUT_SECS: u64 = 600;
666666

667667
/// Returns `false` on a timeout, true otherwise.
668668
pub fn next_block_and_wait(
669-
btc_controller: &mut BitcoinRegtestController,
669+
btc_controller: &BitcoinRegtestController,
670670
blocks_processed: &Arc<AtomicU64>,
671671
) -> bool {
672672
next_block_and_wait_with_timeout(btc_controller, blocks_processed, PANIC_TIMEOUT_SECS)
673673
}
674674

675675
/// Returns `false` on a timeout, true otherwise.
676676
pub fn next_block_and_wait_with_timeout(
677-
btc_controller: &mut BitcoinRegtestController,
677+
btc_controller: &BitcoinRegtestController,
678678
blocks_processed: &Arc<AtomicU64>,
679679
timeout: u64,
680680
) -> bool {
@@ -702,7 +702,7 @@ pub fn next_block_and_wait_with_timeout(
702702

703703
/// Returns `false` on a timeout, true otherwise.
704704
pub fn next_block_and_iterate(
705-
btc_controller: &mut BitcoinRegtestController,
705+
btc_controller: &BitcoinRegtestController,
706706
blocks_processed: &Arc<AtomicU64>,
707707
iteration_delay_ms: u64,
708708
) -> bool {
@@ -734,7 +734,7 @@ pub fn next_block_and_iterate(
734734
///
735735
/// Returns `false` if `next_block_and_wait` times out.
736736
pub fn run_until_burnchain_height(
737-
btc_regtest_controller: &mut BitcoinRegtestController,
737+
btc_regtest_controller: &BitcoinRegtestController,
738738
blocks_processed: &Arc<AtomicU64>,
739739
target_height: u64,
740740
conf: &Config,

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
513513
/// Get the local state machines and most recent peer info from the stacks-node,
514514
/// waiting until all of the signers have updated their state machines to
515515
/// reflect the most recent burn block.
516-
pub fn get_burn_updated_states(&mut self) -> (Vec<LocalStateMachine>, PeerInfo) {
516+
pub fn get_burn_updated_states(&self) -> (Vec<LocalStateMachine>, PeerInfo) {
517517
let info_cur = self.get_peer_info();
518518
let current_rc = self.get_current_reward_cycle();
519519
let mut states = Vec::with_capacity(0);
@@ -731,7 +731,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
731731

732732
/// Get status check results (if returned) from each signer (blocks on the receipt)
733733
/// Returns Some() or None() for each signer, in order of `self.spawned_signers`
734-
pub fn get_all_states(&mut self) -> Vec<StateInfo> {
734+
pub fn get_all_states(&self) -> Vec<StateInfo> {
735735
let mut finished_signers = HashSet::new();
736736
let mut output_states = Vec::new();
737737
let mut sent_request = false;
@@ -795,7 +795,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
795795

796796
/// Get status check results (if returned) from each signer without blocking
797797
/// Returns Some() or None() for each signer, in order of `self.spawned_signers`
798-
pub fn get_states(&mut self, exclude: &HashSet<usize>) -> Vec<Option<StateInfo>> {
798+
pub fn get_states(&self, exclude: &HashSet<usize>) -> Vec<Option<StateInfo>> {
799799
let mut output = Vec::new();
800800
for (ix, signer) in self.spawned_signers.iter().enumerate() {
801801
if exclude.contains(&ix) {
@@ -817,12 +817,12 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
817817

818818
/// Mine a BTC block and wait for a new Stacks block to be mined
819819
/// Note: do not use nakamoto blocks mined heuristic if running a test with multiple miners
820-
fn mine_nakamoto_block(&mut self, timeout: Duration, use_nakamoto_blocks_mined: bool) {
820+
fn mine_nakamoto_block(&self, timeout: Duration, use_nakamoto_blocks_mined: bool) {
821821
let mined_block_time = Instant::now();
822822
let mined_before = self.running_nodes.counters.naka_mined_blocks.get();
823823
let info_before = self.get_peer_info();
824824
next_block_and_mine_commit(
825-
&mut self.running_nodes.btc_regtest_controller,
825+
&self.running_nodes.btc_regtest_controller,
826826
timeout.as_secs(),
827827
&self.running_nodes.conf,
828828
&self.running_nodes.counters,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2824,7 +2824,7 @@ fn bitcoind_forking_test() {
28242824
.unwrap()
28252825
.unwrap();
28262826

2827-
let get_unconfirmed_commit_data = |btc_controller: &mut BitcoinRegtestController| {
2827+
let get_unconfirmed_commit_data = |btc_controller: &BitcoinRegtestController| {
28282828
let unconfirmed_utxo = btc_controller
28292829
.get_all_utxos(&miner_pk)
28302830
.into_iter()

0 commit comments

Comments
 (0)