Skip to content

Commit a2c912d

Browse files
committed
CRC: move monitor_signers to its own mod
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent 362d8e0 commit a2c912d

File tree

6 files changed

+379
-325
lines changed

6 files changed

+379
-325
lines changed

stacks-signer/src/cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ pub struct MonitorSignersArgs {
269269
/// Whether the node is mainnet. Default is false.
270270
#[arg(long, default_value = "false")]
271271
pub mainnet: bool,
272-
/// Set the polling interval in seconds. Default is 60 seconds.
272+
/// Set the polling interval in seconds.
273273
#[arg(long, short, default_value = "60")]
274274
pub interval: u64,
275-
/// Max age in seconds before a signer message is considered stale. Default is 1200 seconds.
275+
/// Max age in seconds before a signer message is considered stale.
276276
#[arg(long, short, default_value = "1200")]
277277
pub max_age: u64,
278278
}

stacks-signer/src/client/stacks_client.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,18 @@ impl StacksClient {
228228
// Get the signer writers from the stacker-db to find the signer slot id
229229
let stackerdb_signer_slots =
230230
self.get_stackerdb_signer_slots(&signer_stackerdb_contract_id, signer_set)?;
231-
let mut signer_slot_ids = HashMap::with_capacity(stackerdb_signer_slots.len());
232-
for (index, (address, _)) in stackerdb_signer_slots.into_iter().enumerate() {
233-
signer_slot_ids.insert(
234-
address,
235-
SignerSlotID(
236-
u32::try_from(index).expect("FATAL: number of signers exceeds u32::MAX"),
237-
),
238-
);
239-
}
240-
Ok(signer_slot_ids)
231+
Ok(stackerdb_signer_slots
232+
.into_iter()
233+
.enumerate()
234+
.map(|(index, (address, _))| {
235+
(
236+
address,
237+
SignerSlotID(
238+
u32::try_from(index).expect("FATAL: number of signers exceeds u32::MAX"),
239+
),
240+
)
241+
})
242+
.collect())
241243
}
242244

243245
/// Get the vote for a given round, reward cycle, and signer address

stacks-signer/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@ pub mod cli;
2929
pub mod client;
3030
/// The configuration module for the signer
3131
pub mod config;
32+
/// The signer monitor for observing signer behaviours in the network
33+
pub mod monitor_signers;
3234
/// The monitoring server for the signer
3335
pub mod monitoring;
3436
/// The primary runloop for the signer
3537
pub mod runloop;
3638
/// The signer state module
3739
pub mod signerdb;
40+
/// The util module for the signer
41+
pub mod utils;
3842
/// The v0 implementation of the signer. This does not include WSTS support
3943
pub mod v0;
4044
/// The v1 implementation of the singer. This includes WSTS support

0 commit comments

Comments
 (0)