Skip to content

Commit c195c68

Browse files
committed
refactor: more suggestions from PR review
1 parent b9d36a1 commit c195c68

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

testnet/stacks-node/src/nakamoto_node/stackerdb_listener.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
use std::collections::BTreeMap;
1717
use std::sync::atomic::{AtomicBool, Ordering};
1818
use std::sync::mpsc::Receiver;
19+
#[cfg(test)]
20+
use std::sync::LazyLock;
1921
use std::sync::{Arc, Condvar, Mutex};
2022
use std::time::Duration;
2123

2224
use hashbrown::{HashMap, HashSet};
23-
#[cfg(test)]
24-
use lazy_static::lazy_static;
2525
use libsigner::v0::messages::{BlockAccepted, BlockResponse, SignerMessage as SignerMessageV0};
2626
use libsigner::SignerEvent;
2727
use stacks::burnchains::Burnchain;
@@ -41,11 +41,9 @@ use crate::event_dispatcher::StackerDBChannel;
4141
use crate::neon::TestFlag;
4242

4343
#[cfg(test)]
44-
lazy_static! {
45-
/// Fault injection flag to prevent the miner from seeing enough signer signatures.
46-
/// Used to test that the signers will broadcast a block if it gets enough signatures
47-
pub static ref TEST_IGNORE_SIGNERS: TestFlag = TestFlag::default();
48-
}
44+
/// Fault injection flag to prevent the miner from seeing enough signer signatures.
45+
/// Used to test that the signers will broadcast a block if it gets enough signatures
46+
pub static TEST_IGNORE_SIGNERS: LazyLock<TestFlag> = LazyLock::new(TestFlag::default);
4947

5048
/// How long should the coordinator poll on the event receiver before
5149
/// waking up to check timeouts?
@@ -243,7 +241,7 @@ impl StackerDBListener {
243241
continue;
244242
};
245243
let slot_ids = modified_slots
246-
.iter()
244+
.into_iter()
247245
.map(|chunk| chunk.slot_id)
248246
.collect::<Vec<_>>();
249247

@@ -354,7 +352,8 @@ impl StackerDBListener {
354352
let (lock, cvar) = &*self.blocks;
355353
let mut blocks = lock.lock().expect("FATAL: failed to lock block status");
356354

357-
let Some(block) = blocks.get_mut(&rejected_data.signer_signature_hash) else {
355+
let Some(block) = blocks.get_mut(&rejected_data.signer_signature_hash)
356+
else {
358357
info!(
359358
"StackerDBListener: Received rejection for block that we did not request. Ignoring.";
360359
"block_signer_sighash" => %rejected_data.signer_signature_hash,

0 commit comments

Comments
 (0)